General information
Category:
Windows API functions
>>Is there a way to trap the a WM_USER message sent to the main foxpro window?
>
>Albert,
>
>There's no way to "trap" (as you would with a keystroke), but setting a timer up to call the PeekMessage API function will allow you to simulate this behavior.
>
>
>hth,
>
>George
Thanks,
What about hooking the system messages with SetWindowsHookEx()?
The following is a skelleton of what I am considering:
HHOOK SetWindowsHookEx(
int idHook, // type of hook to install
HOOKPROC hkprc, // address of hook procedure
HINSTANCE hMod, // handle of application instance
DWORD dwThreadID // identity of thread to install hook for
);
typedef struct tagCWPSTRUCT { // cwps
// Specifies additional information about the message.
// The exact meaning depends on the message value.
LPARAM lParam;
// Specifies additional information about the message.
// The exact meaning depends on the message value.
WPARAM wParam;
// Specifies the message.
UINT message;
// Identifies the window to receive the message.
HWND hwnd;
} CWPSTRUCT;
myHook(WH_CALLWNDPROC, &myCallback, VFP_HInstance, VFP_ThreadID);
// VFP_HInstance, VFP_ThreadID : How do I get these?
LRESULT CALLBACK myCallback(
int nCode, // hook code
WPARAM wParam, // current-process flag
LPARAM lParam // address of structure with message data
)
{
if (lParam->message == MESSAGE_TO_TRAP && lParam->hwnd == VFP_hwnd)
{
PASS MESSAGE BACK TO FOXPRO CODE
}
if (nCode == HC_Action)
{
PROCESS THE MESSAGE
}
return (nCode < 0) ? CallNextHookEx(), 0;
}
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only