Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Show form as circle
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00934377
Message ID:
00934466
Views:
15
There is no problem to get form's HWND in Visual FoxPro versions from 3 to 6. Use GetFocus API function:
DECLARE INTEGER GetFocus IN user32
This function retrieves the handle to the window that has the keyboard focus.

The trick is to call this function at proper time. You can not do it from LOAD or INIT events of the form, because the form's window is not "cooked" yet or not active.

The best place is the ACTIVATE event. Create hWindow property for your form, set default value to 0. In ACTIVATE place the following code:
IF THIS.hWindow = 0
    DECLARE INTEGER GetFocus IN user32
    THIS.hWindow = GetFocus()
ENDIF
This is exactly the same handle that is returned by THIS.HWND in VFP7..9. Use it with API calls when window handle is required.

Two codes samples from my web site (members area):
Round dialog form
http://www.news2news.com/vfp/?example=143

A way to make a transparent area in a form -- a hole in the form
http://www.news2news.com/vfp/?example=126
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform