CallWindowProc
The CallWindowProc
function passes message information to the specified window procedure.
LRESULT CallWindowProc(
WNDPROC lpPrevWndFunc, |
// pointer to
previous procedure |
HWND hWnd, |
// handle to window |
UINT Msg, |
// message |
WPARAM wParam, |
// first message parameter |
LPARAM lParam |
// second message
parameter |
); |
|
Parameters
lpPrevWndFunc
Pointer to
the previous window procedure.
If this value
is obtained by calling the GetWindowLong
hWnd
Identifies
the window procedure to receive the message.
Msg
Specifies the
message.
wParam
Specifies
additional message-specific information. The contents of this parameter depend
on the value of the Msg parameter.
lParam
Specifies
additional message-specific information. The contents of this parameter depend
on the value of the Msg parameter.
Return Values
The return
value specifies the result of the message processing and depends on the message
sent.
Remarks
Use the CallWindowProc
function for window subclassing. Usually, all windows with the same class share
one window procedure. A subclass is a window or set of windows with the same
class whose messages are intercepted and processed by another window procedure
(or procedures) before being passed to the window procedure of the class.
The SetWindowLong
If STRICT is
defined, the lpPrevWndFunc parameter has the data type WNDPROC
LRESULT (CALLBACK* WNDPROC) (HWND, UINT, WPARAM,
LPARAM);
If STRICT is
not defined, the lpPrevWndFunc parameter has the data type FARPROC
int (FAR WINAPI * FARPROC) ()
In C, the FARPROC
declaration indicates a callback function that has an unspecified parameter
list. In C++, however, the empty parameter list in the declaration indicates
that a function has no parameters. This subtle distinction can break careless
code. Following is one way to handle this situation:
#ifdef STRICT
WNDPROC
MyWindowProcedure
#else
FARPROC
MyWindowProcedure
#endif
...
lResult =
CallWindowProc(MyWindowProcedure, ...) ;
For further
information about functions declared with empty argument lists, refer to The
C++ Programming Language, Second Edition, by Bjarne Stroustrup.
Windows
NT: The CallWindowProc
function handles Unicode-to-ANSI conversion. You don t get the conversion if
you call the window procedure directly.
See Also