DefWindowProc

2.x

  LRESULT DefWindowProc(hwnd, uMsg, wParam, lParam)    
  HWND hwnd; /* handle of window, */  
  UINT uMsg; /* type of message, */  
  WPARAM wParam; /* first message parameter */
  LPARAM lParam; /* second message parameter */

The DefWindowProc function calls the default window procedure. The default window procedure provides default processing for any window messages that an application does not process. This function ensures that every message is processed. It should be called with the same parameters as those received by the window procedure.

Parameters

hwnd

Identifies the window that received the message.

uMsg

Specifies the message.

wParam

Specifies 16 bits of additional message-dependent information.

lParam

Specifies 32 bits of additional message-dependent information.

Return Value

The return value is the result of the message processing and depends on the message sent.

Comments

The source code for the DefWindowProc function is provided on the Microsoft Windows 3.1 Software Development Kit (SDK) disks.

Example

The following example shows a typical window procedure. A switch statement is used to process individual messages. All messages not processed are passed on to the DefWindowProc function.

LONG FAR PASCAL MainWndProc(hwnd, message, wParam, lParam)
HWND hwnd;      /* handle of window       */
WORD message;   /* type of message        */
WORD wParam;    /* additional information */
LONG lParam;    /* additional information */
{
    switch (message) {


        /*
         * Process whatever messages you want here and send the
         * rest to DefWindowProc.
         */

        default:
            return (DefWindowProc(hwnd, message, wParam, lParam));

See Also

DefDlgProc