A window procedure is a function that has four parameters and returns a 32-bit
signed value (Longint). The parameters consist of a window handle, a UINT
message identifier, and two message parameters declared with the WParam and
LParam data types. For more information, see the WIN32.HLP.
Message parameters often contain information in both their low-order and
high-order words. The Microsoft® Win32®
application programming interface (API) includes several macros an
application can use to extract information from the message parameters.
The LOWORD function, for example, extracts the low-order word
(bits 0 through 15) from a message parameter.
Other functions include HIWORD, LOBYTE, and HIBYTE.
The interpretation of the return value depends on the particular message.
Consult the description of each message to determine the appropriate return
Because it is possible to call a window procedure recursively, it is important
to minimize the number of local variables that it uses. When processing
individual messages, an application should call functions outside the window
procedure to avoid excessive use of local variables, possibly causing the stack
to overflow during deep recursion.