DwmDefWindowProc function
Applies to: desktop apps only
Default window procedure for Desktop Window Manager (DWM) hit testing within the non-client area.
Syntax
BOOL WINAPI DwmDefWindowProc( __in HWND hwnd, __in UINT msg, __in WPARAM wParam, __in LPARAM lParam, __out LRESULT *plResult );
Parameters
- hwnd [in]
-
A handle to the window procedure that received the message.
- msg [in]
-
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.
- plResult [out]
-
A pointer to an LRESULT value that, when this method returns successfully,receives the result of the hit test.
Return value
TRUE if DwmDefWindowProc handled the message; otherwise, FALSE.
Remarks
When creating custom frames that include the standard caption buttons, WM_NCHITTEST and other non-client hit test messages should first be passed to the DwmDefWindowProc function. This enables the DWM to provide hit testing for the captions buttons. If DwmDefWindowProc does not handle the non-client hit test messages, further processing of these messages might be neccessary.
Requirements
|
Minimum supported client | Windows Vista |
|---|---|
|
Minimum supported server | Windows Server 2008 |
|
Header |
|
|
Library |
|
|
DLL |
|
Send comments about this topic to Microsoft
Build date: 2/14/2012
Note that if you want to extend the glass to fill the entire client area, you MUST specify -1 for ALL properties, not just the first; otherwise, DwmDefWindowProc will not function correctly. When 0 is specified as the top value for DwmExtendFrameIntoClientArea, DwmDefWindowProc will not recognize the caption buttons, and DefWindowProc will default to Windows NT-style caption buttons, creating various interface problems. This indicates that various portions of the DWM API test only single property of the inset margin for negative values, rather than all four, as documented. As such, the sign of all properties should be consistent. If one property is negative, all four MUST be negative, or different functions will handle the frame/client boundary differently. Please see http://www.earth2me.com/development/dwm/ for more information.
Incorrect:
MARGINS mgMarInset = { -1 }; // Will not work: translates to { -1, 0, 0, 0 }
DwmExtendFrameIntoClientArea(hWnd, &mgMarInset);
Correct:
MARGINS mgMarInset = { -1, -1, -1, -1 }; // Correct
DwmExtendFrameIntoClientArea(hWnd, &mgMarInset);
- 6/20/2010
- Zenexer
[DllImport("dwmapi.dll")]
public static extern int DwmDefWindowProc(IntPtr hwnd, ushort msg, long wParam, long lParam, out int plResult);