Export (0) Print
Expand All

DefWindowProc (Compact 2013)

3/28/2014

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.


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

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.

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

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);
}

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

Header

winuser.h

Show:
© 2014 Microsoft