WindowProc callback function
An application-defined function that processes messages sent to a window. The WNDPROC type defines a pointer to this callback function.
WindowProc is a placeholder for the application-defined function name.
Syntax
LRESULT CALLBACK WindowProc(
_In_ HWND hwnd,
_In_ UINT uMsg,
_In_ WPARAM wParam,
_In_ LPARAM lParam
);
Parameters
hwnd [in]
Type: HWNDA handle to the window.
uMsg [in]
Type: UINTThe message.
For lists of the system-provided messages, see System-Defined Messages.
wParam [in]
Type: WPARAMAdditional message information. The contents of this parameter depend on the value of the uMsg parameter.
lParam [in]
Type: LPARAMAdditional message information. The contents of this parameter depend on the value of the uMsg parameter.
Return value
Type: ****
Type: LRESULT
The return value is the result of the message processing and depends on the message sent.
Remarks
If your application runs on a 32-bit version of Windows operating system, uncaught exceptions from the callback will be passed onto higher-level exception handlers of your application when available. The system then calls the unhandled exception filter to handle the exception prior to terminating the process. If the PCA is enabled, it will offer to fix the problem the next time you run the application.
However, if your application runs on a 64-bit version of Windows operating system or WOW64, you should be aware that a 64-bit operating system handles uncaught exceptions differently based on its 64-bit processor architecture, exception architecture, and calling convention. The following table summarizes all possible ways that a 64-bit Windows operating system or WOW64 handles uncaught exceptions.
Behavior type | How the system handles uncaught exceptions |
---|---|
1 | The system suppresses any uncaught exceptions. |
2 | The system first terminates the process, and then the Program Compatibility Assistant (PCA) offers to fix it the next time you run the application. You can disable the PCA mitigation by adding a Compatibility section to the application manifest. |
3 | The system calls the exception filters but suppresses any uncaught exceptions when it leaves the callback scope, without invoking the associated handlers. |
The following table shows how a 64-bit version of Windows operating system or WOW64 handles uncaught exceptions. Notice that behavior type 2 only applies to the 64-bit version of the Windows 7 operating system.
Operating System | WOW64 | 64-bit Windows |
---|---|---|
Windows XP | 3 | 1 |
Windows Server 2003 | 3 | 1 |
Windows Vista | 3 | 1 |
Windows Vista SP1 | 1 | 1 |
Windows 7 and later | 1 | 2 |
Note On Windows 7 with SP1 (32-bit, 64-bit or WOW64), the system calls the unhandled exception filter to handle the exception prior to terminating the process. If the PCA is enabled, it will offer to fix the problem the next time you run the application.
If you need to handle exceptions in your application, you can use structured exception handling to do so. For more information on how to use structured exception handling, see Structured Exception Handling.
Requirements
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
Minimum supported server |
Windows 2000 Server [desktop apps only] |
Header |
Winuser.h (include Windows.h) |
See also
Reference
Conceptual