Partager via


DefWindowProc

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This function calls the default window procedure to provide default processing for any window messages that an application does not process. This function ensures that every message is processed. DefWindowProc is called with the same parameters received by the window procedure.

Syntax

LRESULT DefWindowProc( 
  HWND hWnd, 
  UINT Msg, 
  WPARAM wParam, 
  LPARAM lParam 
); 

Parameters

  • hWnd
    [in] Handle to the window procedure that received the message.
  • Msg
    [in] Specifies the message
  • wParam
    [in] Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.
  • lParam
    [in] Specifies additional message information. The content of this parameter depends on the value of the Msg parameter.

Return Value

The return value is the result of the message processing and depends on the message. If Msg is WM_SETTEXT, zero is returned.

Code Sample

The following code sample describes how a mouse move initiates window procedures.

case WM_MOUSEMOVE:
{
    hUIWnd = GetWindow(hStatusWnd, GW_OWNER);
    hUIPrivate = (HLOCAL)GetWindowLong(hUIWnd, IMMGWL_PRIVATE);
    if (!hUIPrivate)    
        return DefWindowProc (hStatusWnd, uMsg, wParam, lParam);
    lpUIPrivate = (LPUIPRIV)LocalLock(hUIPrivate);
    if (!lpUIPrivate) 
        return DefWindowProc (hStatusWnd, uMsg, wParam, lParam);
    
    if (lpUIPrivate->dwUIMoveOffset != WINDOW_NOT_DRAG) {
        POINT ptCursor;
        DrawDragBorder(hStatusWnd, lpUIPrivate->dwUIMoveXY, 
            lpUIPrivate->dwUIMoveOffset, lpUIPrivate->rcWorkArea);
        GetCursorPos(&ptCursor);
        lpUIPrivate->dwUIMoveXY = MAKELONG(ptCursor.x, ptCursor.y);
        DrawDragBorder(hStatusWnd, lpUIPrivate->dwUIMoveXY, 
            lpUIPrivate->dwUIMoveOffset, lpUIPrivate->rcWorkArea);
        } 
    else {
        LocalUnlock(hUIPrivate);
        return DefWindowProc (hStatusWnd, uMsg, wParam, lParam);
    }
    LocalUnlock(hUIPrivate);
}

Remarks

DefWindowProc does not automatically call PostQuitMessage when it handles a WM_DESTROY message.

Requirements

Header winuser.h
Windows Embedded CE Windows CE 1.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

CallWindowProc
DefDlgProc
WindowProc
Windows Functions