Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function passes message information to the specified window procedure.
LRESULT CallWindowProc( WNDPROC lpPrevWndFunc , HWND hWnd , UINT Msg , WPARAM wParam , LPARAM lParam );
Parameters
If this value is obtained by calling the GetWindowLongfunction with the nIndexparameter set to GWL_WNDPROC or DWL_DLGPROC, it is actually either the address of a window or dialog box procedure, or a handle representing that address.
Return Values
The return value specifies the result of the message processing and depends on the message sent.
Remarks
Use the CallWindowProcfunction 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 SetWindowLongfunction creates the subclass by changing the window procedure associated with a particular window, causing the system to call the new window procedure instead of the previous one. An application must pass any messages not processed by the new window procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a chain of window procedures.
If STRICT is defined, the lpPrevWndFuncparameter has the data type WNDPROC. The WNDPROCtype is declared as follows:
LRESULT (CALLBACK* WNDPROC) (HWND, UINT, WPARAM, LPARAM);
If STRICT is not defined, the lpPrevWndFuncparameter has the data type FARPROC. The FARPROCtype is declared as follows:
int (FAR WINAPI * FARPROC) ()
In C, the FARPROCdeclaration 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 CallWindowProcfunction handles Unicode-to-ANSI conversion. You cannot take advantage of this conversion if you call the window procedure directly.
Requirements
Runs on | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 1.0 and later | Winuser.h |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.
See Also
GetWindowLong, SetClassLong, SetWindowLong