10 out of 21 rated this helpful - Rate this topic

DefWindowProc function

Applies to: desktop apps only

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 WINAPI DefWindowProc(
  __in  HWND hWnd,
  __in  UINT Msg,
  __in  WPARAM wParam,
  __in  LPARAM lParam
);

Parameters

hWnd [in]

Type: HWND

A handle to the window procedure that received the message.

Msg [in]

Type: UINT

The message.

wParam [in]

Type: WPARAM

Additional message information. The content of this parameter depends on the value of the Msg parameter.

lParam [in]

Type: LPARAM

Additional message information. The content of this parameter depends on the value of the Msg parameter.

Return value

Type:

Type: LRESULT

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

Examples

For an example, see Designing a Window Procedure.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

DefWindowProcW (Unicode) and DefWindowProcA (ANSI)

See also

Reference
CallWindowProc
DefDlgProc
WindowProc
Conceptual
Window Procedures

 

 

Send comments about this topic to Microsoft

Build date: 2/3/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
C# syntax
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
vb.net syntax
<DllImport("user32.dll", CharSet:=CharSet.Auto)> Public Shared Function DefWindowProc(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End Function
Possible VB9 declaration
Friend Declare Auto Function DefWindowProc Lib "user32.dll" (ByVal hwnd As Int32, ByVal wMsg As Messages.WindowMessages, ByVal wParam As Int32, ByVal lParam As Int32) As Int32
where Messages.WindowMessages is enumeration of all known window messages and is of type Int32 (see http://dzonny.cz/Software/Blog/tabid/93/EntryID/9/language/en-US/Default.aspx)