Originally Posted by
maxorator
DefWindowProc should be called in addition to your message handling, because it does tons of things for you. It does everything. Activates the window when you click on it in the taskbar, minimizes when the minimize button is pressed, lets you change the window size etc. It is something you should keep, because trying to handle all those things by yourself would be useless.
Hi,
I am just looking at Microsoft's Window Procedure example from
Platform SDK
+ User Interface Services
+ Windows User Interface
+ Windowing
+ Window Procedures
+ Window Procedures Overview
+ Using Window Procedures
This is it:
Code:
LRESULT CALLBACK MainWndProc(
HWND hwnd, // handle to window
UINT uMsg, // message identifier
WPARAM wParam, // first message parameter
LPARAM lParam) // second message parameter
{
switch (uMsg)
{
case WM_CREATE:
// Initialize the window.
return 0;
case WM_PAINT:
// Paint the window's client area.
return 0;
case WM_SIZE:
// Set the size and position of the window.
return 0;
case WM_DESTROY:
// Clean up window-specific data objects.
return 0;
//
// Process other messages.
//
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
return 0;
}
So in Microsoft's example, they only call DefWindowProc if the message has not been processed by the Window Procedure. Is this incorrect? Should that "return 0" read "return DefWindowProc(hwnd, uMsg, wParam, lParam)"?