8 Replies Latest reply on Feb 25, 2011 4:40 PM by 650879

    Problem with dll when using webutil_c_api in Windows 7

    650879
      Hi everybody,

      I have a form that makes use of several Windows' API. They work fine on Windows XP but don´t work on Windows 7. I'm using Forms 10g

      The problem is that they can't find the referenced dll (user32.dll or whichever) althought they are in the path. I've tried to put them even in the current and root directories but doesn't work either.

      The only solution I've found so far is to put the complete path of the dll when invoking the function but is not a good solution.

      Any suggestions on how to make Windows 7 look for the dlls?
        • 1. Re: Problem with dll when using webutil_c_api in Windows 7
          Michael Ferrante-Oracle
          If you are using Win7-64bit this is likely the root of the problem. However, give this a shot :)

          Set the PATH entry in default.env as follows:

          PATH=C:\WINDOWS\system32;C:\WINDOWS;<ADD YOUR ENTRIES HERE>
          • 2. Re: Problem with dll when using webutil_c_api in Windows 7
            650879
            Thank you for your answer Michael.

            Yes, it is Windows 7 Ultimate-64 bits. I have tried your solution but, unfortunately, it does not work. I have also tried to disable UAC with the same result.
            • 3. Re: Problem with dll when using webutil_c_api in Windows 7
              527733
              There is a bug filed for this issue ..
              • 4. Re: Problem with dll when using webutil_c_api in Windows 7
                650879
                Thank you FormsEleven.

                Could you tell me the number of that file to keep trace of it?
                • 5. Re: Problem with dll when using webutil_c_api in Windows 7
                  Michael Ferrante-Oracle
                  I am not aware of a bug being filed against this specific issue. There are/were bugs, but not related to calling out to a 64bit OS or its libs. At this time, calling out to 64bit OS libs is not supported. You can however, call out to your own libraries. Also, calling Windows APIs which require parameter/value pairs is not recommended and in most cases also not supported. If you must access a Windows API, creating a wrapper dll might be the safest approach to ensure the call to Windows is done safely and correctly.

                  That said, I just tested the following and it works correctly. Notice how I specifically point to \system32. This example comes from the latest WebUtil demo.
                  -- IMPORTANT
                  -- Be sure to review the following My Oracle Support Note
                  -- Doc ID: 285331.1 - "Exception When Calling PASCAL style Function Via WebUTIL_C_API"
                  
                  declare
                       
                       rc pls_integer;
                       f_handle WEBUTIL_C_API.FUNCTIONHANDLE;
                       args Webutil_c_api.parameterlist;
                  
                       winSysDir varchar2(255) := Client_Win_API_ENVIRONMENT.Get_Windows_Directory || '\system32\';
                  
                  --- IMPORTANT ---
                  -----------------
                  --
                  -- WEBUTIL_C_API CURRENTLY ONLY SUPPORTS CALLING C STYLE LIBRARIES, THEREFORE SOME WINDOWS LIBRARIES CANNOT BE CALLED.
                  -- ADDITIONALLY, IT IS NOT RECOMMENDED THAT YOU ATTEMPT TO CALL WINDOWS FUNCTIONS WHICH REQUIRE ARGS.
                  --
                  -- USE EXTREME CAUTION WHEN CALLING WINDOWS APIS. 
                  -- BE SURE TO THOROUGHLY TEST BEFORE MOVING TO PRODUCTION
                  -- LOOK CLOSELY AT BOTH STABILITY AND MEMORY USAGE AS SOME CALLS
                  -- MAY RESULT IN THE APPEARANCE OF A MEMORY LEAK.
                  
                  ------------------------------------------------------------------------------------------
                  -- This call to USER32.DLL will reference the LOCKWORKSTATION function.
                  -- If the current OS user does not have a password configured, the workstation may not lock.
                  ------------------------------------------------------------------------------------------
                  
                  -- The Windows LockWorkStation function requires no args to be passed in.
                  -- WebUtil expects something to be passed in. So an empty paramlist will be created.
                  
                  begin
                  
                  If webutil_clientinfo.get_operating_system LIKE 'Win%' Then          
                            
                       f_handle := WEBUTIL_C_API.register_function(winSysDir||'user32.dll','LockWorkStation');
                       args := WEBUTIL_C_API.create_parameter_list;          
                       
                  /*
                  If the function succeeds, the return value is nonzero. Because the function executes asynchronously, 
                  a nonzero return value indicates that the operation has been initiated. It does not indicate whether 
                  the workstation has been successfully locked.  If the function fails, the return value is zero. 
                  
                      http://msdn.microsoft.com/en-us/library/aa376875(v=VS.85).aspx
                  */                                   
                       rc := WEBUTIL_C_API.Invoke_Int(winSysDir||'user32.dll','LockWorkStation',args);     
                  
                  End if;
                  
                    WEBUTIL_C_API.Destroy_Parameter_List(args);
                    WEBUTIL_C_API.Deregister_Function(f_handle);               
                    SYNCHRONIZE;
                                                                                
                  end;
                  • 6. Re: Problem with dll when using webutil_c_api in Windows 7
                    650879
                    Hi Michael.

                    What I am trying to do is the following:

                    FUNCTION GETDOBLECLICK RETURN NUMBER IS
                         v_res NUMBER;
                    BEGIN
                    v_res := webutil_c_api.invoke_long('C:\Windows\System32\user32.dll', 'GetDoubleClickTime', NULL);
                    RETURN v_res;
                    EXCEPTION
                         WHEN OTHERS THEN
                         message('Error code: '||to_char(SQLCODE)||' Txt: '||SQLERRM);
                    END;

                    This code works perfecty on Windows XP but I am not able to get it working on Windows 7. In fact it does not raise any error message; just returns null.

                    The same happens to me when using my own wraper libraries using the full path to them.

                    Thank you.
                    • 7. Re: Problem with dll when using webutil_c_api in Windows 7
                      Michael Ferrante-Oracle
                      I'm not really sure why you are doing what you showed, but I justed tested the following code on a Window 2008 (64-bit) client and it seems to work. That said, if you are attempting to track or respond to a mouse event, you should really use a java bean.

                      Here are a couple of bean examples which look at mouse events:

                      http://forms.pjc.bean.over-blog.com/article-4837790.html
                      http://forms.pjc.bean.over-blog.com/article-4850195.html

                      I'm fairly certain they could be modified to do what you need.

                      Back to your code, here is what I did:
                      declare
                           v_res pls_integer;
                           f_handle WEBUTIL_C_API.FUNCTIONHANDLE;
                           winSysDir varchar2(255) := Client_Win_API_ENVIRONMENT.Get_Windows_Directory || '\system32\';
                      begin
                      
                      If webutil_clientinfo.get_operating_system LIKE 'Win%' Then          
                           
                           f_handle := WEBUTIL_C_API.register_function(winSysDir||'user32.dll','GetDoubleClickTime');     
                           v_res := webutil_c_api.invoke_long(winSysDir||'user32.dll', 'GetDoubleClickTime', NULL);
                           message(v_res);
                      
                      End if;
                           WEBUTIL_C_API.Deregister_Function(f_handle);
                      end;
                      By the way, I don't know what you are expecting, but this always seems to return "500".
                      • 8. Re: Problem with dll when using webutil_c_api in Windows 7
                        650879
                        Hi again, Michael.

                        As I stated in my previous post my code works perfectly on Windows XP. According to the documentation you don´t even need to register the library. My problem has aroused when I have changed my computer and its operating system to Windows 7 Ultimate.

                        The code I have posted is just a test; nothing about mouse events. It gets the minimum speed that you have to make a doubleclik at, in order to be interpreted as a doubleclik and not as two different clicks. If you change the doubleclick speed (the access to mouse properties is different on different operating systems) you´ll get different numbers when using the mentioned code.

                        Thanks for your patience,

                        Edited by: Valla1 on Feb 25, 2011 5:38 PM

                        Edited by: Valla1 on Feb 25, 2011 5:40 PM