2 * Default window procedure
4 * Copyright 1993, 1996 Alexandre Julliard
14 #include "nonclient.h"
17 #include "debugtools.h"
24 #include "wine/unicode.h"
25 #include "wine/winuser16.h"
26 #include "wine/winestring.h"
28 DEFAULT_DEBUG_CHANNEL(win
);
30 /* bits in the dwKeyData */
31 #define KEYDATA_ALT 0x2000
32 #define KEYDATA_PREVSTATE 0x4000
34 static short iF10Key
= 0;
35 static short iMenuSysKey
= 0;
37 /***********************************************************************
38 * DEFWND_HandleWindowPosChanged
40 * Handle the WM_WINDOWPOSCHANGED message.
42 static void DEFWND_HandleWindowPosChanged( WND
*wndPtr
, UINT flags
)
44 WPARAM16 wp
= SIZE_RESTORED
;
46 if (!(flags
& SWP_NOCLIENTMOVE
))
47 SendMessage16( wndPtr
->hwndSelf
, WM_MOVE
, 0,
48 MAKELONG(wndPtr
->rectClient
.left
, wndPtr
->rectClient
.top
));
49 if (!(flags
& SWP_NOCLIENTSIZE
))
51 if (wndPtr
->dwStyle
& WS_MAXIMIZE
) wp
= SIZE_MAXIMIZED
;
52 else if (wndPtr
->dwStyle
& WS_MINIMIZE
) wp
= SIZE_MINIMIZED
;
54 SendMessage16( wndPtr
->hwndSelf
, WM_SIZE
, wp
,
55 MAKELONG(wndPtr
->rectClient
.right
-wndPtr
->rectClient
.left
,
56 wndPtr
->rectClient
.bottom
-wndPtr
->rectClient
.top
));
61 /***********************************************************************
64 * Set the window text.
66 void DEFWND_SetTextA( WND
*wndPtr
, LPCSTR text
)
71 count
= MultiByteToWideChar( CP_ACP
, 0, text
, -1, NULL
, 0 );
73 if (wndPtr
->text
) HeapFree(SystemHeap
, 0, wndPtr
->text
);
74 if ((wndPtr
->text
= HeapAlloc(SystemHeap
, 0, count
* sizeof(WCHAR
))))
75 MultiByteToWideChar( CP_ACP
, 0, text
, -1, wndPtr
->text
, count
);
77 ERR("Not enough memory for window text");
79 wndPtr
->pDriver
->pSetText(wndPtr
, wndPtr
->text
);
82 /***********************************************************************
85 * Set the window text.
87 void DEFWND_SetTextW( WND
*wndPtr
, LPCWSTR text
)
89 static const WCHAR empty_string
[] = {0};
92 if (!text
) text
= empty_string
;
93 count
= strlenW(text
) + 1;
95 if (wndPtr
->text
) HeapFree(SystemHeap
, 0, wndPtr
->text
);
96 if ((wndPtr
->text
= HeapAlloc(SystemHeap
, 0, count
* sizeof(WCHAR
))))
97 strcpyW( wndPtr
->text
, text
);
99 ERR("Not enough memory for window text");
101 wndPtr
->pDriver
->pSetText(wndPtr
, wndPtr
->text
);
104 /***********************************************************************
105 * DEFWND_ControlColor
107 * Default colors for control painting.
109 HBRUSH
DEFWND_ControlColor( HDC hDC
, UINT16 ctlType
)
111 if( ctlType
== CTLCOLOR_SCROLLBAR
)
113 HBRUSH hb
= GetSysColorBrush(COLOR_SCROLLBAR
);
114 if (TWEAK_WineLook
== WIN31_LOOK
) {
115 SetTextColor( hDC
, RGB(0, 0, 0) );
116 SetBkColor( hDC
, RGB(255, 255, 255) );
118 COLORREF bk
= GetSysColor(COLOR_3DHILIGHT
);
119 SetTextColor( hDC
, GetSysColor(COLOR_3DFACE
));
120 SetBkColor( hDC
, bk
);
122 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
123 * we better use 0x55aa bitmap brush to make scrollbar's background
124 * look different from the window background.
126 if (bk
== GetSysColor(COLOR_WINDOW
)) {
127 return CACHE_GetPattern55AABrush();
130 UnrealizeObject( hb
);
134 SetTextColor( hDC
, GetSysColor(COLOR_WINDOWTEXT
));
136 if (TWEAK_WineLook
> WIN31_LOOK
) {
137 if ((ctlType
== CTLCOLOR_EDIT
) || (ctlType
== CTLCOLOR_LISTBOX
))
138 SetBkColor( hDC
, GetSysColor(COLOR_WINDOW
) );
140 SetBkColor( hDC
, GetSysColor(COLOR_3DFACE
) );
141 return GetSysColorBrush(COLOR_3DFACE
);
145 SetBkColor( hDC
, GetSysColor(COLOR_WINDOW
) );
146 return GetSysColorBrush(COLOR_WINDOW
);
150 /***********************************************************************
153 static void DEFWND_SetRedraw( WND
* wndPtr
, WPARAM wParam
)
155 BOOL bVisible
= wndPtr
->dwStyle
& WS_VISIBLE
;
157 TRACE("%04x %i\n", wndPtr
->hwndSelf
, (wParam
!=0) );
163 wndPtr
->dwStyle
|= WS_VISIBLE
;
164 DCE_InvalidateDCE( wndPtr
, &wndPtr
->rectWindow
);
169 if( wndPtr
->dwStyle
& WS_MINIMIZE
) wParam
= RDW_VALIDATE
;
170 else wParam
= RDW_ALLCHILDREN
| RDW_VALIDATE
;
172 PAINT_RedrawWindow( wndPtr
->hwndSelf
, NULL
, 0, wParam
, 0 );
173 DCE_InvalidateDCE( wndPtr
, &wndPtr
->rectWindow
);
174 wndPtr
->dwStyle
&= ~WS_VISIBLE
;
178 /***********************************************************************
181 * This method handles the default behavior for the WM_PRINT message.
183 static void DEFWND_Print(
191 if ( (uFlags
& PRF_CHECKVISIBLE
) &&
192 !IsWindowVisible(wndPtr
->hwndSelf
) )
196 * Unimplemented flags.
198 if ( (uFlags
& PRF_CHILDREN
) ||
199 (uFlags
& PRF_OWNED
) ||
200 (uFlags
& PRF_NONCLIENT
) )
202 WARN("WM_PRINT message with unsupported flags\n");
208 if ( uFlags
& PRF_ERASEBKGND
)
209 SendMessageA(wndPtr
->hwndSelf
, WM_ERASEBKGND
, (WPARAM
)hdc
, 0);
214 if ( uFlags
& PRF_CLIENT
)
215 SendMessageA(wndPtr
->hwndSelf
, WM_PRINTCLIENT
, (WPARAM
)hdc
, PRF_CLIENT
);
218 /***********************************************************************
221 * Default window procedure for messages that are the same in Win16 and Win32.
223 static LRESULT
DEFWND_DefWinProc( WND
*wndPtr
, UINT msg
, WPARAM wParam
,
229 return NC_HandleNCPaint( wndPtr
->hwndSelf
, (HRGN
)wParam
);
234 pt
.x
= SLOWORD(lParam
);
235 pt
.y
= SHIWORD(lParam
);
236 return NC_HandleNCHitTest( wndPtr
->hwndSelf
, pt
);
239 case WM_NCLBUTTONDOWN
:
240 return NC_HandleNCLButtonDown( wndPtr
, wParam
, lParam
);
242 case WM_LBUTTONDBLCLK
:
243 case WM_NCLBUTTONDBLCLK
:
244 return NC_HandleNCLButtonDblClk( wndPtr
, wParam
, lParam
);
248 if ((wndPtr
->flags
& WIN_ISWIN32
) || (TWEAK_WineLook
> WIN31_LOOK
))
250 ClientToScreen16(wndPtr
->hwndSelf
, (LPPOINT16
)&lParam
);
251 SendMessageA( wndPtr
->hwndSelf
, WM_CONTEXTMENU
,
252 wndPtr
->hwndSelf
, lParam
);
257 if( wndPtr
->dwStyle
& WS_CHILD
)
258 SendMessageA( wndPtr
->parent
->hwndSelf
, msg
, wParam
, lParam
);
259 else if (wndPtr
->hSysMenu
)
263 pt
.x
= SLOWORD(lParam
);
264 pt
.y
= SHIWORD(lParam
);
266 ScreenToClient(wndPtr
->hwndSelf
, &pt
);
267 hitcode
= NC_HandleNCHitTest(wndPtr
->hwndSelf
, pt
);
269 /* Track system popup if click was in the caption area. */
270 if (hitcode
==HTCAPTION
|| hitcode
==HTSYSMENU
)
271 TrackPopupMenu(GetSystemMenu(wndPtr
->hwndSelf
, FALSE
),
272 TPM_LEFTBUTTON
| TPM_RIGHTBUTTON
,
273 pt
.x
, pt
.y
, 0, wndPtr
->hwndSelf
, NULL
);
278 return NC_HandleNCActivate( wndPtr
, wParam
);
281 if (wndPtr
->text
) HeapFree( SystemHeap
, 0, wndPtr
->text
);
283 if (wndPtr
->pVScroll
) HeapFree( SystemHeap
, 0, wndPtr
->pVScroll
);
284 if (wndPtr
->pHScroll
) HeapFree( SystemHeap
, 0, wndPtr
->pHScroll
);
285 wndPtr
->pVScroll
= wndPtr
->pHScroll
= NULL
;
289 DEFWND_Print(wndPtr
, (HDC
)wParam
, lParam
);
296 HDC16 hdc
= BeginPaint16( wndPtr
->hwndSelf
, &ps
);
299 if( (wndPtr
->dwStyle
& WS_MINIMIZE
) && wndPtr
->class->hIcon
)
301 int x
= (wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
-
302 GetSystemMetrics(SM_CXICON
))/2;
303 int y
= (wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
-
304 GetSystemMetrics(SM_CYICON
))/2;
305 TRACE("Painting class icon: vis rect=(%i,%i - %i,%i)\n",
306 ps
.rcPaint
.left
, ps
.rcPaint
.top
, ps
.rcPaint
.right
, ps
.rcPaint
.bottom
);
307 DrawIcon( hdc
, x
, y
, wndPtr
->class->hIcon
);
309 EndPaint16( wndPtr
->hwndSelf
, &ps
);
315 if (wndPtr
->hrgnUpdate
)
317 RedrawWindow ( wndPtr
->hwndSelf
, 0, wndPtr
->hrgnUpdate
,
318 RDW_ERASENOW
| RDW_ERASE
| RDW_FRAME
| RDW_ALLCHILDREN
);
323 DEFWND_SetRedraw( wndPtr
, wParam
);
327 DestroyWindow( wndPtr
->hwndSelf
);
330 case WM_MOUSEACTIVATE
:
331 if (wndPtr
->dwStyle
& WS_CHILD
)
333 LONG ret
= SendMessage16( wndPtr
->parent
->hwndSelf
,
334 WM_MOUSEACTIVATE
, wParam
, lParam
);
338 /* Caption clicks are handled by the NC_HandleNCLButtonDown() */
339 return (LOWORD(lParam
) >= HTCLIENT
) ? MA_ACTIVATE
: MA_NOACTIVATE
;
342 /* The default action in Windows is to set the keyboard focus to
343 * the window, if it's being activated and not minimized */
344 if (LOWORD(wParam
) != WA_INACTIVE
) {
345 if (!(wndPtr
->dwStyle
& WS_MINIMIZE
))
346 SetFocus(wndPtr
->hwndSelf
);
351 if (wndPtr
->dwStyle
& WS_CHILD
)
353 return SendMessageA( wndPtr
->parent
->hwndSelf
,
354 WM_MOUSEWHEEL
, wParam
, lParam
);
359 case WM_ICONERASEBKGND
:
363 if (!wndPtr
->class->hbrBackground
) return 0;
365 /* Since WM_ERASEBKGND may receive either a window dc or a */
366 /* client dc, the area to be erased has to be retrieved from */
367 /* the device context. */
368 GetClipBox( (HDC
)wParam
, &rect
);
370 /* Always call the Win32 variant of FillRect even on Win16,
371 * since despite the fact that Win16, as well as Win32,
372 * supports special background brushes for a window class,
373 * the Win16 variant of FillRect does not.
375 FillRect( (HDC
) wParam
, &rect
, wndPtr
->class->hbrBackground
);
382 case WM_CTLCOLORMSGBOX
:
383 case WM_CTLCOLOREDIT
:
384 case WM_CTLCOLORLISTBOX
:
387 case WM_CTLCOLORSTATIC
:
388 case WM_CTLCOLORSCROLLBAR
:
389 return (LRESULT
)DEFWND_ControlColor( (HDC
)wParam
, msg
- WM_CTLCOLORMSGBOX
);
392 return (LRESULT
)DEFWND_ControlColor( (HDC
)wParam
, HIWORD(lParam
) );
394 case WM_GETTEXTLENGTH
:
395 if (wndPtr
->text
) return (LRESULT
)strlenW(wndPtr
->text
);
399 if (wndPtr
->dwStyle
& WS_CHILD
)
400 if (SendMessage16(wndPtr
->parent
->hwndSelf
, WM_SETCURSOR
,
403 return NC_HandleSetCursor( wndPtr
->hwndSelf
, wParam
, lParam
);
408 pt
.x
= SLOWORD(lParam
);
409 pt
.y
= SHIWORD(lParam
);
410 return NC_HandleSysCommand( wndPtr
->hwndSelf
, wParam
, pt
);
414 if(wParam
== VK_F10
) iF10Key
= VK_F10
;
418 if( HIWORD(lParam
) & KEYDATA_ALT
)
420 /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
421 if( wParam
== VK_MENU
&& !iMenuSysKey
)
428 if( wParam
== VK_F4
) /* try to close the window */
430 HWND hWnd
= WIN_GetTopParent( wndPtr
->hwndSelf
);
431 wndPtr
= WIN_FindWndPtr( hWnd
);
432 if( wndPtr
&& !(wndPtr
->class->style
& CS_NOCLOSE
) )
433 PostMessage16( hWnd
, WM_SYSCOMMAND
, SC_CLOSE
, 0 );
434 WIN_ReleaseWndPtr(wndPtr
);
437 else if( wParam
== VK_F10
)
440 if( wParam
== VK_ESCAPE
&& (GetKeyState(VK_SHIFT
) & 0x8000))
441 SendMessage16( wndPtr
->hwndSelf
, WM_SYSCOMMAND
,
442 (WPARAM16
)SC_KEYMENU
, (LPARAM
)VK_SPACE
);
447 /* Press and release F10 or ALT */
448 if (((wParam
== VK_MENU
) && iMenuSysKey
) ||
449 ((wParam
== VK_F10
) && iF10Key
))
450 SendMessage16( WIN_GetTopParent(wndPtr
->hwndSelf
),
451 WM_SYSCOMMAND
, SC_KEYMENU
, 0L );
452 iMenuSysKey
= iF10Key
= 0;
457 if (wParam
== VK_RETURN
&& (wndPtr
->dwStyle
& WS_MINIMIZE
))
459 PostMessage16( wndPtr
->hwndSelf
, WM_SYSCOMMAND
,
460 (WPARAM16
)SC_RESTORE
, 0L );
463 if ((HIWORD(lParam
) & KEYDATA_ALT
) && wParam
)
465 if (wParam
== VK_TAB
|| wParam
== VK_ESCAPE
) break;
466 if (wParam
== VK_SPACE
&& (wndPtr
->dwStyle
& WS_CHILD
))
467 SendMessage16( wndPtr
->parent
->hwndSelf
, msg
, wParam
, lParam
);
469 SendMessage16( wndPtr
->hwndSelf
, WM_SYSCOMMAND
,
470 (WPARAM16
)SC_KEYMENU
, (LPARAM
)(DWORD
)wParam
);
472 else /* check for Ctrl-Esc */
473 if (wParam
!= VK_ESCAPE
) MessageBeep(0);
477 if (!lParam
) return 0; /* sent from ShowWindow */
478 if (!(wndPtr
->dwStyle
& WS_POPUP
) || !wndPtr
->owner
) return 0;
479 if ((wndPtr
->dwStyle
& WS_VISIBLE
) && wParam
) return 0;
480 else if (!(wndPtr
->dwStyle
& WS_VISIBLE
) && !wParam
) return 0;
481 ShowWindow( wndPtr
->hwndSelf
, wParam
? SW_SHOWNOACTIVATE
: SW_HIDE
);
485 if (wndPtr
->parent
== WIN_GetDesktop()) EndMenu();
486 if (GetCapture() == wndPtr
->hwndSelf
) ReleaseCapture();
487 WIN_ReleaseDesktop();
497 case WM_QUERYDROPOBJECT
:
498 if (wndPtr
->dwExStyle
& WS_EX_ACCEPTFILES
) return 1;
501 case WM_QUERYDRAGICON
:
506 if( (hIcon
=wndPtr
->class->hCursor
) ) return (LRESULT
)hIcon
;
507 for(len
=1; len
<64; len
++)
508 if((hIcon
=LoadIcon16(wndPtr
->hInstance
,MAKEINTRESOURCE16(len
))))
509 return (LRESULT
)hIcon
;
510 return (LRESULT
)LoadIcon16(0,IDI_APPLICATION16
);
514 case WM_ISACTIVEICON
:
515 return ((wndPtr
->flags
& WIN_NCACTIVATED
) != 0);
517 case WM_NOTIFYFORMAT
:
518 if (IsWindowUnicode(wndPtr
->hwndSelf
)) return NFR_UNICODE
;
519 else return NFR_ANSI
;
522 case WM_QUERYENDSESSION
:
527 int index
= (wParam
!= ICON_SMALL
) ? GCL_HICON
: GCL_HICONSM
;
528 HICON16 hOldIcon
= GetClassLongA(wndPtr
->hwndSelf
, index
);
529 SetClassLongA(wndPtr
->hwndSelf
, index
, lParam
);
531 SetWindowPos(wndPtr
->hwndSelf
, 0, 0, 0, 0, 0, SWP_FRAMECHANGED
532 | SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOACTIVATE
535 if( wndPtr
->flags
& WIN_NATIVE
)
536 wndPtr
->pDriver
->pSetHostAttr(wndPtr
, HAK_ICONS
, 0);
543 int index
= (wParam
!= ICON_SMALL
) ? GCL_HICON
: GCL_HICONSM
;
544 return GetClassLongA(wndPtr
->hwndSelf
, index
);
548 SendMessageA( wndPtr
->parent
->hwndSelf
, msg
, wParam
, lParam
);
557 /***********************************************************************
558 * DefWindowProc16 (USER.107)
560 LRESULT WINAPI
DefWindowProc16( HWND16 hwnd
, UINT16 msg
, WPARAM16 wParam
,
563 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
566 if (!wndPtr
) return 0;
567 SPY_EnterMessage( SPY_DEFWNDPROC16
, hwnd
, msg
, wParam
, lParam
);
573 CREATESTRUCT16
*cs
= (CREATESTRUCT16
*)PTR_SEG_TO_LIN(lParam
);
575 DEFWND_SetTextA( wndPtr
, (LPCSTR
)PTR_SEG_TO_LIN(cs
->lpszName
) );
583 CONV_RECT16TO32( (RECT16
*)PTR_SEG_TO_LIN(lParam
), &rect32
);
584 result
= NC_HandleNCCalcSize( wndPtr
, &rect32
);
585 CONV_RECT32TO16( &rect32
, (RECT16
*)PTR_SEG_TO_LIN(lParam
) );
589 case WM_WINDOWPOSCHANGING
:
590 result
= WINPOS_HandleWindowPosChanging16( wndPtr
,
591 (WINDOWPOS16
*)PTR_SEG_TO_LIN(lParam
) );
594 case WM_WINDOWPOSCHANGED
:
596 WINDOWPOS16
* winPos
= (WINDOWPOS16
*)PTR_SEG_TO_LIN(lParam
);
597 DEFWND_HandleWindowPosChanged( wndPtr
, winPos
->flags
);
602 if (wParam
&& wndPtr
->text
)
604 lstrcpynWtoA( (LPSTR
)PTR_SEG_TO_LIN(lParam
), wndPtr
->text
, wParam
);
605 result
= (LRESULT
)strlen( (LPSTR
)PTR_SEG_TO_LIN(lParam
) );
610 DEFWND_SetTextA( wndPtr
, (LPCSTR
)PTR_SEG_TO_LIN(lParam
) );
611 if( (wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
612 NC_HandleNCPaint( hwnd
, (HRGN
)1 );
616 result
= DEFWND_DefWinProc( wndPtr
, msg
, wParam
, lParam
);
620 WIN_ReleaseWndPtr(wndPtr
);
621 SPY_ExitMessage( SPY_RESULT_DEFWND16
, hwnd
, msg
, result
, wParam
, lParam
);
626 /***********************************************************************
627 * DefWindowProcA [USER32.126]
630 LRESULT WINAPI
DefWindowProcA( HWND hwnd
, UINT msg
, WPARAM wParam
,
633 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
636 if (!wndPtr
) return 0;
637 SPY_EnterMessage( SPY_DEFWNDPROC
, hwnd
, msg
, wParam
, lParam
);
643 CREATESTRUCTA
*cs
= (CREATESTRUCTA
*)lParam
;
644 if (cs
->lpszName
) DEFWND_SetTextA( wndPtr
, cs
->lpszName
);
650 result
= NC_HandleNCCalcSize( wndPtr
, (RECT
*)lParam
);
653 case WM_WINDOWPOSCHANGING
:
654 result
= WINPOS_HandleWindowPosChanging( wndPtr
,
655 (WINDOWPOS
*)lParam
);
658 case WM_WINDOWPOSCHANGED
:
660 WINDOWPOS
* winPos
= (WINDOWPOS
*)lParam
;
661 DEFWND_HandleWindowPosChanged( wndPtr
, winPos
->flags
);
666 if (wParam
&& wndPtr
->text
)
668 lstrcpynWtoA( (LPSTR
)lParam
, wndPtr
->text
, wParam
);
669 result
= (LRESULT
)strlen( (LPSTR
)lParam
);
674 DEFWND_SetTextA( wndPtr
, (LPCSTR
)lParam
);
675 if( (wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
676 NC_HandleNCPaint( hwnd
, (HRGN
)1 ); /* Repaint caption */
680 result
= DEFWND_DefWinProc( wndPtr
, msg
, wParam
, lParam
);
684 WIN_ReleaseWndPtr(wndPtr
);
685 SPY_ExitMessage( SPY_RESULT_DEFWND
, hwnd
, msg
, result
, wParam
, lParam
);
690 /***********************************************************************
691 * DefWindowProcW [USER32.127] Calls default window message handler
693 * Calls default window procedure for messages not processed
697 * Return value is dependent upon the message.
699 LRESULT WINAPI
DefWindowProcW(
700 HWND hwnd
, /* [in] window procedure recieving message */
701 UINT msg
, /* [in] message identifier */
702 WPARAM wParam
, /* [in] first message parameter */
703 LPARAM lParam
) /* [in] second message parameter */
705 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
708 if (!wndPtr
) return 0;
709 SPY_EnterMessage( SPY_DEFWNDPROC
, hwnd
, msg
, wParam
, lParam
);
715 CREATESTRUCTW
*cs
= (CREATESTRUCTW
*)lParam
;
716 if (cs
->lpszName
) DEFWND_SetTextW( wndPtr
, cs
->lpszName
);
722 if (wParam
&& wndPtr
->text
)
724 lstrcpynW( (LPWSTR
)lParam
, wndPtr
->text
, wParam
);
725 result
= strlenW( (LPWSTR
)lParam
);
730 DEFWND_SetTextW( wndPtr
, (LPCWSTR
)lParam
);
731 if( (wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
732 NC_HandleNCPaint( hwnd
, (HRGN
)1 ); /* Repaint caption */
736 result
= DefWindowProcA( hwnd
, msg
, wParam
, lParam
);
739 WIN_ReleaseWndPtr(wndPtr
);
740 SPY_ExitMessage( SPY_RESULT_DEFWND
, hwnd
, msg
, result
, wParam
, lParam
);