Information générale
Catégorie:
Fonctions Windows API
>>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;
}
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement