Wiki Home

This Form . h Wnd


Namespace: WIN_COM_API

hWnd ( the handle to the current window) has long been a bugbear with pre VFP7 programmers.

If you put the declare
 Declare Integer  GetFocus in user32 

in your Form Class Load (or wherever you place your Win API definitions),

add a property
 hWnd 
to your Form Class and place the code
 ThisForm.hWnd = GetFocus() 
in your Form Class Activate, you will always have a reference to the forms window handle. Of course, this code is of no use in VFP7 as the property is exposed anyway.
-- Peter Easson
( Topic last updated: 2002.06.14 06:40:18 PM )