Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is the easiest way to get Window handle value?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00051377
Message ID:
00051470
Views:
55
>>>>I'm trying to integrate VFP 5.0 with the ComputerEyes video capture card and SDK....
>>>>
>>>>I need to be able to get the actual handle number of a form to feed to the OCX SDK call...
>>>>
>>>>What is the easiest way to do it....I would have thought that their would have been a function
>>>>like 'hWnd=GetHandle()' or some variation...
>>>>
>>>>Or, do I have to build a C wrapper as described in the docs?
>>>>
>>>>Thanks,
>>>>
>>>>Jon
>>>
>>>Sometimes, Active-x will be happy with VFP handle, returned by Win32api FindWindow function.
>>
>>The VFP main window handle can also be obtained through the FOXTOOLS.FLL function MainHWnd(). However, if neither of the these is successful, you can try GetTopWindow. It will return the handle of the first child window in the Z order. Pass it the value returned by MainHWnd().
>>
>>George
>
>George,
>
>Well I am able to get the main window with the following,
>----------------
>CLEAR
>DECLARE INTEGER GetActiveWindow IN win32api
>WAIT WINDOW "You can switch to another application now" TIMEOUT 5
>? GetActiveWindow( )
>
>or
>
>SET LIBRARY TO FOXTOOLS.FLL
>?MainHwnd()
>----------------
>
>I would like to get to the handle of a child window/form......
>
>I don't know where to look for your refernece to 'GetTopWindow' ?
>
>Maybe I missed something....I'm using VFP 5.0 with Serv Pak 2....

Jon,

Here's the declaration:

DECLARE INTEGER GetTopWindow IN WIN32API;
INTEGER hwnd

Then to retrieve the child window:

lnmainhwnd = MainHWnd()
lnchildhwnd = GetTopWindow(lnmainhwnd)

However, I personally think that it's easier to use the FoxHWnd control and pass the HWnd property of that to whatever is going to use it. I done some work with it and it seems to work as advertised.

George
>
>Thanks,
>
>Jon
George

Ubi caritas et amor, deus ibi est
Previous
Reply
Map
View

Click here to load this message in the networking platform