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 formhttp://www.news2news.com/vfp/?example=143A way to make a transparent area in a form -- a hole in the formhttp://www.news2news.com/vfp/?example=126