Window Procedure

From ReliCodia

(Difference between revisions)
Revision as of 19:00, 8 January 2005
216.231.56.29 (Talk | contribs)

← Previous diff
Revision as of 19:01, 8 January 2005
216.231.56.29 (Talk | contribs)

Next diff →
Line 1: Line 1:
-Window procedure is a callback function. The Windows operating system calls this function whenever an event, such as a mouse-click, a keystroke, etc., occurs. In general, a windows program is driven by such events. The information about the event is encapsulated in a [[API:Windows_Message|Windows Message]].+Window procedure is a callback function. The Windows operating system calls this function whenever an event, such as a mouse-click, a keystroke, etc., occurs. In general, a windows program is driven by such events. The information about the event is encapsulated in a [[API:Windows Message|Windows Message]].
A separate window procedure should be written for each class of windows. The pointer to such procedure is registered with the system through [[API:WNDCLASS|Windows Class]] structure in the call to [[API:RegisterClass|RegisterClass]]. A separate window procedure should be written for each class of windows. The pointer to such procedure is registered with the system through [[API:WNDCLASS|Windows Class]] structure in the call to [[API:RegisterClass|RegisterClass]].
Line 7: Line 7:
LRESULT CALLBACK MyProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK MyProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-where ''hwnd'' is the handle to the window to which the message is directed; and ''message'', ''wParam'', and ''lParam'', describe the [[API:Windows_Message|Windows Message]]+where ''hwnd'' is the handle to the window to which the message is directed; and ''message'', ''wParam'', and ''lParam'', describe the [[API:Windows Message|Windows Message]]

Revision as of 19:01, 8 January 2005

Window procedure is a callback function. The Windows operating system calls this function whenever an event, such as a mouse-click, a keystroke, etc., occurs. In general, a windows program is driven by such events. The information about the event is encapsulated in a Windows Message.

A separate window procedure should be written for each class of windows. The pointer to such procedure is registered with the system through Windows Class structure in the call to RegisterClass.

The signature of a window procedure must be this:

LRESULT CALLBACK MyProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)

where hwnd is the handle to the window to which the message is directed; and message, wParam, and lParam, describe the Windows Message