Window Procedure

From ReliCodia

(Difference between revisions)
Revision as of 18:58, 8 January 2005
216.231.56.29 (Talk | contribs)
Described procedure
← Previous diff
Revision as of 19:00, 8 January 2005
216.231.56.29 (Talk | contribs)

Next diff →
Line 5: Line 5:
The signature of a window procedure must be this: The signature of a window procedure must be this:
-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:00, 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