LRESULT CALLBACK CallWndProc(nCode, wParam, lParam) | |||||
int nCode; | /* action flag | */ | |||
WPARAM wParam; | /* current-task flag | */ | |||
LPARAM lParam; | /* pointer to structure with message data | */ |
The CallWndProc function is a library-defined callback function that the system calls whenever the SendMessage function is called. The system passes the 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 a CWPSTRUCT structure that contains details about the message.
The CWPSTRUCT structure has the following form:
typedef struct tagCWPSTRUCT { /* cwps */
LPARAM lParam;
WPARAM wParam;
DWORD message;
HWND hwnd;
} CWPSTRUCT;
The callback function should return zero.
The CallWndProc callback function can examine or modify the message as desired. Once the function returns control to the system, the message, with any modifications, is passed on to the window procedure.
An application must install the callback function by specifying the WH_CALLWNDPROC filter type and address of the callback function in a call to the SetWindowsHookEx function.
CallWndProc 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, SendMessage, SetWindowsHookEx