WindowProc
Encyclopedia
In Win32 application programming, WindowProc (or window procedure) is a user-defined callback function
Callback (computer science)
In computer programming, a callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine defined in a higher-level layer....

 that processes messages sent to a window. This function is specified when an application registers its window class
Window class
In computer programming a window class is a structure fundamental to the Microsoft Windows operating systems and its Application Programming Interface ....

, 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
Function prototype
A function prototype in C, Perl or C++ is a declaration of a function that omits the function body but does specify the function's return type, name, arity and argument types...

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.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK