- 6.3. -
Table of Contents
6. Win32 Programming
6.3. Designing a Window Procedure
6.3. Designing 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;
- 6.3. -