LRESULT CallWindowProc(wndprcPrev, hwnd, uMsg, wParam, lParam) | |||||
WNDPROC wndprcPrev; | /* instance address of previous procedure | */ | |||
HWND hwnd; | /* handle of window, */ | ||||
UINT uMsg; | /* message | */ | |||
WPARAM wParam; | /* first message parameter | */ | |||
LPARAM lParam; | /* second message parameter | */ |
The CallWindowProc function passes message information to the specified window procedure.
wndprcPrev
Specifies the procedure-instance address of the previous window procedure.
hwnd
Identifies the window that will receive the message.
uMsg
Specifies the message.
wParam
Specifies 16 bits of additional message-dependent information.
lParam
Specifies 32 bits of additional message-dependent information.
The return value specifies the result of the message processing and depends on the message sent.
The CallWindowProc function is used for window subclassing. Normally, all windows with the same class share the same window procedure. A subclass is a window or set of windows belonging to the same window class whose messages are intercepted and processed by another window procedure (or procedures) before being passed to the window procedure of that class.
The SetWindowLong function creates the subclass by changing the window procedure associated with a particular window, causing Windows to call the new window procedure instead of the previous one. Any messages not processed by the new window procedure must be passed to the previous window procedure by calling CallWindowProc. This allows you to create a chain of window procedures.