DefWindowProc Function
DefWindowProc Function

The DefWindowProc 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.

Remarks

Windows 95/98/Me: DefWindowProcW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems.

Example

For an example, see Designing a Window Procedure.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as ANSI and Unicode versions.

See Also

Community Content

Possible VB9 declaration
Added by:Đonny
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)
vb.net syntax
Added by:dmex
<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
C# syntax
Added by:dmex
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern IntPtr DefWindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam);
© 2010 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View