LRESULT CALLBACK GetMsgProc(nCode, wParam, lParam) | |||||
int nCode; | /* action flag | */ | |||
WPARAM wParam; | /* undefined | */ | |||
LPARAM lParam; | /* address of structure with message | */ |
The GetMsgProc function is an application- or library-defined callback function that the system calls whenever the GetMessage function has retrieved a message from an application queue. The system passes the retrieved message to the callback function before passing the message to the destination window procedure.
nCode
Specifies whether the callback function should process the message or pass it to the CallNextHookEx function. If nCode is equal to HC_ACTION, the callback function should process the message. If nCode is a negative value, the callback function should pass the message to CallNextHookEx.
wParam
Specifies whether the message is sent by the current process. It is nonzero if the message is sent by the current process; otherwise, it is NULL.
lParam
Points to an MSG structure that contains details about the message.
The MSG structure has the following form:
typedef struct tagMSG { /* msg */
HWND hwnd;
UINT message;
WPARAM wParam;
LPARAM lParam;
DWORD time;
POINT pt;
} MSG;
The callback function should return 0.
The GetMsgProc callback function can examine or modify the message as desired. Once the callback function returns control to the system, the GetMessage function returns the message, with any modifications, to the application that originally called it.
An application must install the callback function by specifying the WH_GETMESSAGE filter type and address of the callback function in a call to the SetWindowsHook function.
GetMsgProc is a placeholder for the application- or library-defined function name. The actual name must be exported by including it in the EXPORTS statement in a module-definition file.
CallNextHookEx, GetMessage, SetWindowsHookEx