- 6.3 -
Win32 ProgrammingDesigning a Window Procedure
The following example shows the structure of a typical window procedure.
The window procedure uses the message argument in a Case statement
to process. For messages that it does not process, the window procedure calls
the DefWindowProc function in WIN32.HLP.
function MainWndProc conv arg_stdcall (
_hwnd: HWND, // handle of window
_uMsg: UINT, // message identifier
_wParam: WPARAM, // first message parameter
_lParam: LPARAM // second message parameter
): LRESULT;
begin
case _uMsg of
WM_CREATE:
begin // Initialize the window.
Result := 0;
end;
WM_PAINT:
begin // Paint the window's client area.
Result := 0;
end;
WM_SIZE:
begin // Set the size and position of the window.
Result := 0;
end;
WM_DESTROY:
begin // Clean up window-specific data objects.
Result := 0;
end;
// Process other messages.
else
Result := DefWindowProc(_hwnd, _uMsg, _wParam, _lParam);
end;
end;
|
|
|
Structure of Window Procedure |
Table of Content |
Associating a Window Procedure with a Window Class |
- 6.3 -