WindowProc

WindowProc

In Win32 application programming, WindowProc (or window procedure) is a user-defined callback function that processes messages sent to a window. This function is specified when an application registers its window class, and can be named anything. (not necessarily WindowProc)

Message handling

The window procedure is responsible for handling all messages that are sent to a window. The function prototype of WindowProc is given by: LRESULT CALLBACK WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)"hWnd" is a handle to the window to which the message was sent and "uMsg" identifies the actual message. "wParam" and "lParam" are parameters whose meaning depends on the message. An application should identify the message and take the required action.

Default processing

Hundreds of different messages are produced as a result of various events taking place in the system, and typically, an application processes only a small fraction of these messages. In order to ensure that all messages are processed, Windows provides a default window procedure called DefWindowProc that provides default processing for messages that the application itself does not process.

An application usually calls DefWindowProc at the end of its own WindowProc function so that whatever messages it has not processed are passed on to the default procedure.

ee also

*Event loop

External links

* [http://msdn2.microsoft.com/en-us/library/ms633573.aspx WindowProc at MSDN]
* [http://msdn2.microsoft.com/en-us/library/ms633572.aspx DefWindowProc at MSDN]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Event loop — In computer science, the event loop, message dispatcher, message loop, message pump, or run loop is a programming construct that waits for and dispatches events or messages in a program. It works by polling some internal or external event… …   Wikipedia

  • BEE Lisp — Значимость предмета статьи поставлена под сомнение. Пожалуйста, покажите в статье значимость её предмета, добавив в неё доказательства значимости по частным критериям значимости или, в случае если частные критерии значимости для… …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”