Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Active Handle
Message
 
 
To
18/02/2008 15:47:52
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01293107
Message ID:
01293745
Views:
14
Hi Greg,


The third parameter for FindWindowEx() function is window class name not AxtiveX class name. More details at http://msdn2.microsoft.com/en-us/library/ms632597.aspx#class_name.
If you've Visual Studio, you can use Spy++ tool to find info about any window, or you can use George Tasker's SpyFoxFox File #9908.
You don't need to pass string by reference if it's not output parameter. When you pass string by reference it has to be terminated with CHR()0).
* By reference (not necessary)
DECLARE INTEGER FindWindowEx IN "user32.dll" ;
             INTEGER, INTEGER, STRING @, INTEGER
lcWindClass = "AfxOleControl80" + CHR(0)       && this would be the Window class name for AX
lhAXHdl = FindWindowEx(thisform.HWnd, 0, @lcWindClass, 0)
* By value (preferred)
DECLARE INTEGER FindWindowEx IN "user32.dll" ;
             INTEGER, INTEGER, STRING , INTEGER
lcWindClass = "AfxOleControl80"       && this would be the Window class name for AX
lhAXHdl = FindWindowEx(thisform.HWnd, 0, lcWindClass,0)
>Thank you for the above link; this led me to the missing information that I needed. I found the Win32 API call:
>
>FindWindowEx
>
>that would get the handle for the active-x as a child on a form; but I needed to know the active-x class name for the function to work. The above referenced link gave me that information. I was trying the class name that is displayed for the OLE class in VFP, but this was not giving the handle (always returned 0). With a test form (with the active-x placed on it) and the above referenced code, I was able to determine the actual active-x class name. Now with the following code, the Active-x handle can be determined:
>
>
>LOCAL lcOLEClass, lhAXHdl
>DECLARE INTEGER FindWindowEx IN "user32.dll" ;
>             INTEGER, INTEGER, STRING @, STRING @
>lcOLEClass = "AfxOleControl80"        && this would be the class name for AX
>lhAXHdl = FindWindowEx(thisform.HWnd,0,@lcOLEClass,0)
>...
>
>
>Thanks again for your help.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform