>I am new to API programming. Is there anyway to get the handle to windows and controls in FoxPro? I am trying to call a function within a DLL which requires both the handle to a window and the handle to a control within that window. Also, I am wondering how to get the value of WM_USER so that I can pick a unique identifier for the transfer message.
>
>The DLL function's declaration:
>int Init(HWND hWnd, HWND hMsgWnd, UINT nXferMsg, in nFlag);
>nXferMsg should be WM_USER + n
>
VFP doesn't behave well relative to other WinApps; individual controls do not necessarily have an hWnd of their own to use to send messages to them.
If VFP is the foreground process, the WinAPI call GetActiveWindow() will retrieve the hWnd for the VFP form currently on top. GetActiveWindow can be declared in VFP as follows:
DECLARE INTEGER GetActiveWindow IN WIN32API
There arre also functions in FoxTools that can get handles for various things in VFP - download George Tasker's excellent Extended Help for FoxTools from the File Section here.
WM_USER is a constant from Visual C; the base value is 0x0400; you can assign a value relative to that for your own uses. Be aware that other things do this too; you might do well to take a peek at VC++'s WINUSER.H in its INCLUDE directory.
>Any help would be greatly appreciated.
>
>Paul Ezerski