3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS user32.dll
5 * FILE: lib/user32/windows/window.c
6 * PURPOSE: Window management
7 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
9 * 06-06-2001 CSH Created
12 /* INCLUDES ******************************************************************/
16 #include <wine/debug.h>
17 WINE_DEFAULT_DEBUG_CHANNEL(user32
);
20 #define WM_SETVISIBLE 9
22 #ifndef WM_QUERYDROPOBJECT
23 #define WM_QUERYDROPOBJECT 0x022B
26 LRESULT
DefWndNCPaint(HWND hWnd
, HRGN hRgn
, BOOL Active
);
27 LRESULT
DefWndNCCalcSize(HWND hWnd
, BOOL CalcSizeStruct
, RECT
*Rect
);
28 LRESULT
DefWndNCActivate(HWND hWnd
, WPARAM wParam
);
29 LRESULT
DefWndNCHitTest(HWND hWnd
, POINT Point
);
30 LRESULT
DefWndNCLButtonDown(HWND hWnd
, WPARAM wParam
, LPARAM lParam
);
31 LRESULT
DefWndNCLButtonDblClk(HWND hWnd
, WPARAM wParam
, LPARAM lParam
);
32 void FASTCALL
MenuInitSysMenuPopup(HMENU Menu
, DWORD Style
, DWORD ClsStyle
, LONG HitTest
);
34 /* GLOBALS *******************************************************************/
36 COLORREF SysColors
[NUM_SYSCOLORS
] = {0};
37 HPEN SysPens
[NUM_SYSCOLORS
] = {0};
38 HBRUSH SysBrushes
[NUM_SYSCOLORS
] = {0};
40 /* Bits in the dwKeyData */
41 #define KEYDATA_ALT 0x2000
42 #define KEYDATA_PREVSTATE 0x4000
44 static short iF10Key
= 0;
45 static short iMenuSysKey
= 0;
47 /* FUNCTIONS *****************************************************************/
50 InitStockObjects(void)
52 /* FIXME - Instead of copying the stuff to usermode we should map the tables to
53 userland. The current implementation has one big flaw: the system color
54 table doesn't get updated when another process changes them. That's why
55 we should rather map the table into usermode. But it only affects the
56 SysColors table - the pens, brushes and stock objects are not affected
57 as their handles never change. But it'd be faster to map them, too. */
58 if(SysBrushes
[0] == NULL
)
60 /* only initialize once */
61 (void)NtUserGetSysColors(SysColors
, NUM_SYSCOLORS
);
62 (void)NtUserGetSysColorPens(SysPens
, NUM_SYSCOLORS
);
63 (void)NtUserGetSysColorBrushes(SysBrushes
, NUM_SYSCOLORS
);
71 GetSysColor(int nIndex
)
73 if(nIndex
>= 0 && nIndex
<= NUM_SYSCOLORS
)
75 return SysColors
[nIndex
];
78 SetLastError(ERROR_INVALID_PARAMETER
);
86 GetSysColorPen(int nIndex
)
88 if(nIndex
>= 0 && nIndex
<= NUM_SYSCOLORS
)
90 return SysPens
[nIndex
];
93 SetLastError(ERROR_INVALID_PARAMETER
);
101 GetSysColorBrush(int nIndex
)
103 if(nIndex
>= 0 && nIndex
<= NUM_SYSCOLORS
)
105 return SysBrushes
[nIndex
];
108 SetLastError(ERROR_INVALID_PARAMETER
);
119 CONST INT
*lpaElements
,
120 CONST COLORREF
*lpaRgbValues
)
129 ChangeSysColors
.Elements
= (INT
*)lpaElements
;
130 ChangeSysColors
.Colors
= (COLORREF
*)lpaRgbValues
;
134 Ret
= NtUserSetSysColors(&ChangeSysColors
, cElements
);
137 /* FIXME - just change it in the usermode structure, too, instead of asking win32k again */
138 (void)NtUserGetSysColors(SysColors
, NUM_SYSCOLORS
);
143 SetLastError(ERROR_INVALID_PARAMETER
);
151 UserGetInsideRectNC(HWND hWnd
, RECT
*rect
)
157 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
158 ExStyle
= GetWindowLongW(hWnd
, GWL_EXSTYLE
);
159 GetWindowRect(hWnd
, &WindowRect
);
160 rect
->top
= rect
->left
= 0;
161 rect
->right
= WindowRect
.right
- WindowRect
.left
;
162 rect
->bottom
= WindowRect
.bottom
- WindowRect
.top
;
164 if (Style
& WS_ICONIC
)
169 /* Remove frame from rectangle */
170 if (UserHasThickFrameStyle(Style
, ExStyle
))
172 InflateRect(rect
, -GetSystemMetrics(SM_CXFRAME
),
173 -GetSystemMetrics(SM_CYFRAME
));
177 if (UserHasDlgFrameStyle(Style
, ExStyle
))
179 InflateRect(rect
, -GetSystemMetrics(SM_CXDLGFRAME
),
180 -GetSystemMetrics(SM_CYDLGFRAME
));
181 /* FIXME: this isn't in NC_AdjustRect? why not? */
182 if (ExStyle
& WS_EX_DLGMODALFRAME
)
183 InflateRect( rect
, -1, 0 );
187 if (UserHasThinFrameStyle(Style
, ExStyle
))
189 InflateRect(rect
, -GetSystemMetrics(SM_CXBORDER
),
190 -GetSystemMetrics(SM_CYBORDER
));
198 DefWndSetRedraw(HWND hWnd
, WPARAM wParam
)
200 LONG Style
= GetWindowLong(hWnd
, GWL_STYLE
);
201 /* Content can be redrawn after a change. */
204 if (!(Style
& WS_VISIBLE
)) /* Not Visible */
206 SetWindowLong(hWnd
, GWL_STYLE
, WS_VISIBLE
);
209 else /* Content cannot be redrawn after a change. */
211 if (Style
& WS_VISIBLE
) /* Visible */
213 RedrawWindow( hWnd
, NULL
, 0, RDW_ALLCHILDREN
| RDW_VALIDATE
);
214 Style
&= ~WS_VISIBLE
;
215 SetWindowLong(hWnd
, GWL_STYLE
, Style
); /* clear bits */
223 DefWndHandleSetCursor(HWND hWnd
, WPARAM wParam
, LPARAM lParam
, ULONG Style
)
225 /* Not for child windows. */
226 if (hWnd
!= (HWND
)wParam
)
231 switch((INT_PTR
) LOWORD(lParam
))
235 WORD Msg
= HIWORD(lParam
);
236 if (Msg
== WM_LBUTTONDOWN
|| Msg
== WM_MBUTTONDOWN
||
237 Msg
== WM_RBUTTONDOWN
|| Msg
== WM_XBUTTONDOWN
)
246 HICON hCursor
= (HICON
)GetClassLongW(hWnd
, GCL_HCURSOR
);
258 if (Style
& WS_MAXIMIZE
)
262 return((LRESULT
)SetCursor(LoadCursorW(0, IDC_SIZEWE
)));
268 if (Style
& WS_MAXIMIZE
)
272 return((LRESULT
)SetCursor(LoadCursorW(0, IDC_SIZENS
)));
278 if (Style
& WS_MAXIMIZE
)
282 return((LRESULT
)SetCursor(LoadCursorW(0, IDC_SIZENWSE
)));
288 if (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_MAXIMIZE
)
292 return((LRESULT
)SetCursor(LoadCursorW(0, IDC_SIZENESW
)));
295 return((LRESULT
)SetCursor(LoadCursorW(0, IDC_ARROW
)));
299 DefWndStartSizeMove(HWND hWnd
, WPARAM wParam
, POINT
*capturePoint
)
305 ULONG Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
307 GetWindowRect(hWnd
, &rectWindow
);
309 if ((wParam
& 0xfff0) == SC_MOVE
)
311 /* Move pointer at the center of the caption */
313 UserGetInsideRectNC(hWnd
, &rect
);
314 if (Style
& WS_SYSMENU
)
315 rect
.left
+= GetSystemMetrics(SM_CXSIZE
) + 1;
316 if (Style
& WS_MINIMIZEBOX
)
317 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
318 if (Style
& WS_MAXIMIZEBOX
)
319 rect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
320 pt
.x
= rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
321 pt
.y
= rectWindow
.top
+ rect
.top
+ GetSystemMetrics(SM_CYSIZE
)/2;
330 if (GetMessageW(&msg
, NULL
, 0, 0) <= 0)
335 hittest
= DefWndNCHitTest(hWnd
, msg
.pt
);
336 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
348 pt
.x
=(rectWindow
.left
+rectWindow
.right
)/2;
349 pt
.y
= rectWindow
.top
+ GetSystemMetrics(SM_CYFRAME
) / 2;
353 pt
.x
=(rectWindow
.left
+rectWindow
.right
)/2;
354 pt
.y
= rectWindow
.bottom
- GetSystemMetrics(SM_CYFRAME
) / 2;
358 pt
.x
= rectWindow
.left
+ GetSystemMetrics(SM_CXFRAME
) / 2;
359 pt
.y
=(rectWindow
.top
+rectWindow
.bottom
)/2;
363 pt
.x
= rectWindow
.right
- GetSystemMetrics(SM_CXFRAME
) / 2;
364 pt
.y
=(rectWindow
.top
+rectWindow
.bottom
)/2;
367 case VK_ESCAPE
: return 0;
373 SetCursorPos( pt
.x
, pt
.y
);
374 DefWndHandleSetCursor(hWnd
, (WPARAM
)hWnd
, MAKELONG(hittest
, WM_MOUSEMOVE
), Style
);
378 #define ON_LEFT_BORDER(hit) \
379 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
380 #define ON_RIGHT_BORDER(hit) \
381 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
382 #define ON_TOP_BORDER(hit) \
383 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
384 #define ON_BOTTOM_BORDER(hit) \
385 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
388 UserDrawWindowFrame(HDC hdc
, const RECT
*rect
,
389 ULONG width
, ULONG height
)
391 static HBRUSH hDraggingRectBrush
= NULL
;
394 if(!hDraggingRectBrush
)
396 static HBITMAP hDraggingPattern
= NULL
;
397 const DWORD Pattern
[4] = {0x5555AAAA, 0x5555AAAA, 0x5555AAAA, 0x5555AAAA};
399 hDraggingPattern
= CreateBitmap(8, 8, 1, 1, Pattern
);
400 hDraggingRectBrush
= CreatePatternBrush(hDraggingPattern
);
403 hbrush
= SelectObject( hdc
, hDraggingRectBrush
);
404 PatBlt( hdc
, rect
->left
, rect
->top
,
405 rect
->right
- rect
->left
- width
, height
, PATINVERT
);
406 PatBlt( hdc
, rect
->left
, rect
->top
+ height
, width
,
407 rect
->bottom
- rect
->top
- height
, PATINVERT
);
408 PatBlt( hdc
, rect
->left
+ width
, rect
->bottom
- 1,
409 rect
->right
- rect
->left
- width
, -height
, PATINVERT
);
410 PatBlt( hdc
, rect
->right
- 1, rect
->top
, -width
,
411 rect
->bottom
- rect
->top
- height
, PATINVERT
);
412 SelectObject( hdc
, hbrush
);
416 UserDrawMovingFrame(HDC hdc
, RECT
*rect
, BOOL thickframe
)
420 UserDrawWindowFrame(hdc
, rect
, GetSystemMetrics(SM_CXFRAME
), GetSystemMetrics(SM_CYFRAME
));
424 UserDrawWindowFrame(hdc
, rect
, 1, 1);
429 DefWndDoSizeMove(HWND hwnd
, WORD wParam
)
433 RECT sizingRect
, mouseRect
, origRect
, clipRect
, unmodRect
;
435 LONG hittest
= (LONG
)(wParam
& 0x0f);
436 HCURSOR hDragCursor
= 0, hOldCursor
= 0;
437 POINT minTrack
, maxTrack
;
438 POINT capturePoint
, pt
;
439 ULONG Style
= GetWindowLongW(hwnd
, GWL_STYLE
);
440 ULONG ExStyle
= GetWindowLongW(hwnd
, GWL_EXSTYLE
);
442 BOOL iconic
= Style
& WS_MINIMIZE
;
444 DWORD dwPoint
= GetMessagePos();
445 BOOL DragFullWindows
= FALSE
;
446 HWND hWndParent
= NULL
;
448 SystemParametersInfoA(SPI_GETDRAGFULLWINDOWS
, 0, &DragFullWindows
, 0);
450 pt
.x
= GET_X_LPARAM(dwPoint
);
451 pt
.y
= GET_Y_LPARAM(dwPoint
);
454 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
))
459 thickframe
= UserHasThickFrameStyle(Style
, ExStyle
) && !(Style
& WS_MINIMIZE
);
460 if ((wParam
& 0xfff0) == SC_MOVE
)
464 hittest
= DefWndStartSizeMove(hwnd
, wParam
, &capturePoint
);
477 if (hittest
&& ((wParam
& 0xfff0) != SC_MOUSEMENU
))
479 hittest
+= (HTLEFT
- WMSZ_LEFT
);
484 hittest
= DefWndStartSizeMove(hwnd
, wParam
, &capturePoint
);
493 /* Get min/max info */
495 WinPosGetMinMaxInfo(hwnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
496 GetWindowRect(hwnd
, &sizingRect
);
497 if (Style
& WS_CHILD
)
499 hWndParent
= GetParent(hwnd
);
500 MapWindowPoints( 0, hWndParent
, (LPPOINT
)&sizingRect
, 2 );
501 unmodRect
= sizingRect
;
502 GetClientRect(hWndParent
, &mouseRect
);
503 clipRect
= mouseRect
;
504 MapWindowPoints(hWndParent
, HWND_DESKTOP
, (LPPOINT
)&clipRect
, 2);
508 if(!(ExStyle
& WS_EX_TOPMOST
))
510 SystemParametersInfoW(SPI_GETWORKAREA
, 0, &clipRect
, 0);
511 mouseRect
= clipRect
;
515 SetRect(&mouseRect
, 0, 0, GetSystemMetrics(SM_CXSCREEN
), GetSystemMetrics(SM_CYSCREEN
));
516 clipRect
= mouseRect
;
518 unmodRect
= sizingRect
;
520 ClipCursor(&clipRect
);
522 origRect
= sizingRect
;
523 if (ON_LEFT_BORDER(hittest
))
525 mouseRect
.left
= max( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
526 mouseRect
.right
= min( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
528 else if (ON_RIGHT_BORDER(hittest
))
530 mouseRect
.left
= max( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
531 mouseRect
.right
= min( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
533 if (ON_TOP_BORDER(hittest
))
535 mouseRect
.top
= max( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
536 mouseRect
.bottom
= min( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
538 else if (ON_BOTTOM_BORDER(hittest
))
540 mouseRect
.top
= max( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
541 mouseRect
.bottom
= min( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
543 if (Style
& WS_CHILD
)
545 MapWindowPoints( hWndParent
, 0, (LPPOINT
)&mouseRect
, 2 );
548 SendMessageA( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
549 (void)NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE
, hwnd
);
550 if (GetCapture() != hwnd
) SetCapture( hwnd
);
552 if (Style
& WS_CHILD
)
554 /* Retrieve a default cache DC (without using the window style) */
555 hdc
= GetDCEx(hWndParent
, 0, DCX_CACHE
);
561 DesktopRgn
= CreateRectRgnIndirect(&clipRect
);
564 SelectObject(hdc
, DesktopRgn
);
566 if( iconic
) /* create a cursor for dragging */
568 HICON hIcon
= (HICON
)GetClassLongW(hwnd
, GCL_HICON
);
569 if(!hIcon
) hIcon
= (HICON
)SendMessageW( hwnd
, WM_QUERYDRAGICON
, 0, 0L);
570 if( hIcon
) hDragCursor
= CursorIconToCursor( hIcon
, TRUE
);
571 if( !hDragCursor
) iconic
= FALSE
;
574 /* invert frame if WIN31_LOOK to indicate mouse click on caption */
575 if( !iconic
&& !DragFullWindows
)
577 UserDrawMovingFrame( hdc
, &sizingRect
, thickframe
);
584 if (GetMessageW(&msg
, 0, 0, 0) <= 0)
587 /* Exit on button-up, Return, or Esc */
588 if ((msg
.message
== WM_LBUTTONUP
) ||
589 ((msg
.message
== WM_KEYDOWN
) &&
590 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
592 if (msg
.message
== WM_PAINT
)
594 if(!iconic
&& !DragFullWindows
) UserDrawMovingFrame( hdc
, &sizingRect
, thickframe
);
595 UpdateWindow( msg
.hwnd
);
596 if(!iconic
&& !DragFullWindows
) UserDrawMovingFrame( hdc
, &sizingRect
, thickframe
);
600 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
601 continue; /* We are not interested in other messages */
605 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
607 case VK_UP
: pt
.y
-= 8; break;
608 case VK_DOWN
: pt
.y
+= 8; break;
609 case VK_LEFT
: pt
.x
-= 8; break;
610 case VK_RIGHT
: pt
.x
+= 8; break;
613 pt
.x
= max( pt
.x
, mouseRect
.left
);
614 pt
.x
= min( pt
.x
, mouseRect
.right
);
615 pt
.y
= max( pt
.y
, mouseRect
.top
);
616 pt
.y
= min( pt
.y
, mouseRect
.bottom
);
618 dx
= pt
.x
- capturePoint
.x
;
619 dy
= pt
.y
- capturePoint
.y
;
627 if( iconic
) /* ok, no system popup tracking */
629 hOldCursor
= SetCursor(hDragCursor
);
634 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
637 RECT newRect
= unmodRect
;
638 WPARAM wpSizingHit
= 0;
640 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
641 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
642 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
643 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
644 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
645 if(!iconic
&& !DragFullWindows
) UserDrawMovingFrame( hdc
, &sizingRect
, thickframe
);
648 /* determine the hit location */
649 if (hittest
>= HTLEFT
&& hittest
<= HTBOTTOMRIGHT
)
650 wpSizingHit
= WMSZ_LEFT
+ (hittest
- HTLEFT
);
652 SendMessageA( hwnd
, WM_SIZING
, wpSizingHit
, (LPARAM
)&newRect
);
657 UserDrawMovingFrame( hdc
, &newRect
, thickframe
);
659 /* To avoid any deadlocks, all the locks on the windows
660 structures must be suspended before the SetWindowPos */
661 SetWindowPos( hwnd
, 0, newRect
.left
, newRect
.top
,
662 newRect
.right
- newRect
.left
,
663 newRect
.bottom
- newRect
.top
,
664 ( hittest
== HTCAPTION
) ? SWP_NOSIZE
: 0 );
667 sizingRect
= newRect
;
676 if( moved
) /* restore cursors, show icon title later on */
679 SetCursor( hOldCursor
);
681 DestroyCursor( hDragCursor
);
683 else if(!DragFullWindows
)
684 UserDrawMovingFrame( hdc
, &sizingRect
, thickframe
);
686 if (Style
& WS_CHILD
)
687 ReleaseDC( hWndParent
, hdc
);
693 DeleteObject(DesktopRgn
);
696 (void)NtUserSetGUIThreadHandle(MSQ_STATE_MOVESIZE
, NULL
);
697 SendMessageA( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
698 SendMessageA( hwnd
, WM_SETVISIBLE
, !IsIconic(hwnd
), 0L);
700 /* window moved or resized */
703 /* if the moving/resizing isn't canceled call SetWindowPos
704 * with the new position or the new size of the window
706 if (!((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) )
708 /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
710 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
711 sizingRect
.right
- sizingRect
.left
,
712 sizingRect
.bottom
- sizingRect
.top
,
713 ( hittest
== HTCAPTION
) ? SWP_NOSIZE
: 0 );
715 else { /* restore previous size/position */
717 SetWindowPos( hwnd
, 0, origRect
.left
, origRect
.top
,
718 origRect
.right
- origRect
.left
,
719 origRect
.bottom
- origRect
.top
,
720 ( hittest
== HTCAPTION
) ? SWP_NOSIZE
: 0 );
725 if( Style
& WS_MINIMIZE
)
727 /* Single click brings up the system menu when iconized */
731 if( Style
& WS_SYSMENU
)
732 SendMessageA( hwnd
, WM_SYSCOMMAND
,
733 SC_MOUSEMENU
+ HTSYSMENU
, MAKELONG(pt
.x
,pt
.y
));
739 /***********************************************************************
740 * DefWndTrackScrollBar
742 * Track a mouse button press on the horizontal or vertical scroll-bar.
745 DefWndTrackScrollBar(HWND Wnd
, WPARAM wParam
, POINT Pt
)
749 if (SC_HSCROLL
== (wParam
& 0xfff0))
751 if (HTHSCROLL
!= (wParam
& 0x0f))
757 else /* SC_VSCROLL */
759 if (HTVSCROLL
!= (wParam
& 0x0f))
765 ScrollTrackScrollBar(Wnd
, ScrollBar
, Pt
);
770 DefWndHandleSysCommand(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
775 switch (wParam
& 0xfff0)
779 DefWndDoSizeMove(hWnd
, wParam
);
782 wp
.length
= sizeof(WINDOWPLACEMENT
);
783 if(GetWindowPlacement(hWnd
, &wp
))
785 wp
.showCmd
= SW_MINIMIZE
;
786 SetWindowPlacement(hWnd
, &wp
);
790 wp
.length
= sizeof(WINDOWPLACEMENT
);
791 if(GetWindowPlacement(hWnd
, &wp
))
793 wp
.showCmd
= SW_MAXIMIZE
;
794 SetWindowPlacement(hWnd
, &wp
);
798 wp
.length
= sizeof(WINDOWPLACEMENT
);
799 if(GetWindowPlacement(hWnd
, &wp
))
801 wp
.showCmd
= SW_RESTORE
;
802 SetWindowPlacement(hWnd
, &wp
);
806 SendMessageA(hWnd
, WM_CLOSE
, 0, 0);
810 Pt
.x
= (short)LOWORD(lParam
);
811 Pt
.y
= (short)HIWORD(lParam
);
812 MenuTrackMouseMenuBar(hWnd
, wParam
& 0x000f, Pt
);
816 MenuTrackKbdMenuBar(hWnd
, wParam
, (WCHAR
)lParam
);
821 Pt
.x
= (short)LOWORD(lParam
);
822 Pt
.y
= (short)HIWORD(lParam
);
823 DefWndTrackScrollBar(hWnd
, wParam
, Pt
);
828 /* FIXME: Implement */
837 DefWndHandleWindowPosChanging(HWND hWnd
, WINDOWPOS
* Pos
)
839 POINT maxTrack
, minTrack
;
840 LONG style
= GetWindowLongA(hWnd
, GWL_STYLE
);
842 if (Pos
->flags
& SWP_NOSIZE
) return 0;
843 if ((style
& WS_THICKFRAME
) || ((style
& (WS_POPUP
| WS_CHILD
)) == 0))
845 WinPosGetMinMaxInfo(hWnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
846 Pos
->cx
= min(Pos
->cx
, maxTrack
.x
);
847 Pos
->cy
= min(Pos
->cy
, maxTrack
.y
);
848 if (!(style
& WS_MINIMIZE
))
850 if (Pos
->cx
< minTrack
.x
) Pos
->cx
= minTrack
.x
;
851 if (Pos
->cy
< minTrack
.y
) Pos
->cy
= minTrack
.y
;
856 Pos
->cx
= max(Pos
->cx
, 0);
857 Pos
->cy
= max(Pos
->cy
, 0);
862 /* Undocumented flags. */
863 #define SWP_NOCLIENTMOVE 0x0800
864 #define SWP_NOCLIENTSIZE 0x1000
867 DefWndHandleWindowPosChanged(HWND hWnd
, WINDOWPOS
* Pos
)
871 GetClientRect(hWnd
, &Rect
);
872 MapWindowPoints(hWnd
, (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CHILD
?
873 GetParent(hWnd
) : NULL
), (LPPOINT
) &Rect
, 2);
875 if (! (Pos
->flags
& SWP_NOCLIENTMOVE
))
877 SendMessageW(hWnd
, WM_MOVE
, 0, MAKELONG(Rect
.left
, Rect
.top
));
880 if (! (Pos
->flags
& SWP_NOCLIENTSIZE
))
882 WPARAM wp
= SIZE_RESTORED
;
887 else if (IsIconic(hWnd
))
891 SendMessageW(hWnd
, WM_SIZE
, wp
,
892 MAKELONG(Rect
.right
- Rect
.left
, Rect
.bottom
- Rect
.top
));
898 /***********************************************************************
901 * Default colors for control painting.
904 DefWndControlColor(HDC hDC
, UINT ctlType
)
906 if (CTLCOLOR_SCROLLBAR
== ctlType
)
908 HBRUSH hb
= GetSysColorBrush(COLOR_SCROLLBAR
);
909 COLORREF bk
= GetSysColor(COLOR_3DHILIGHT
);
910 SetTextColor(hDC
, GetSysColor(COLOR_3DFACE
));
913 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
914 * we better use 0x55aa bitmap brush to make scrollbar's background
915 * look different from the window background.
917 if (bk
== GetSysColor(COLOR_WINDOW
))
919 static const WORD wPattern55AA
[] =
921 0x5555, 0xaaaa, 0x5555, 0xaaaa,
922 0x5555, 0xaaaa, 0x5555, 0xaaaa
924 static HBITMAP hPattern55AABitmap
= NULL
;
925 static HBRUSH hPattern55AABrush
= NULL
;
926 if (hPattern55AABrush
== NULL
)
928 hPattern55AABitmap
= CreateBitmap(8, 8, 1, 1, wPattern55AA
);
929 hPattern55AABrush
= CreatePatternBrush(hPattern55AABitmap
);
931 return hPattern55AABrush
;
937 SetTextColor(hDC
, GetSysColor(COLOR_WINDOWTEXT
));
939 if ((CTLCOLOR_EDIT
== ctlType
) || (CTLCOLOR_LISTBOX
== ctlType
))
941 SetBkColor(hDC
, GetSysColor(COLOR_WINDOW
));
945 SetBkColor(hDC
, GetSysColor(COLOR_3DFACE
));
946 return GetSysColorBrush(COLOR_3DFACE
);
949 return GetSysColorBrush(COLOR_WINDOW
);
952 static void DefWndPrint( HWND hwnd
, HDC hdc
, ULONG uFlags
)
957 if ( (uFlags
& PRF_CHECKVISIBLE
) &&
958 !IsWindowVisible(hwnd
) )
962 * Unimplemented flags.
964 if ( (uFlags
& PRF_CHILDREN
) ||
965 (uFlags
& PRF_OWNED
) ||
966 (uFlags
& PRF_NONCLIENT
) )
968 FIXME("WM_PRINT message with unsupported flags\n");
974 if ( uFlags
& PRF_ERASEBKGND
)
975 SendMessageW(hwnd
, WM_ERASEBKGND
, (WPARAM
)hdc
, 0);
980 if ( uFlags
& PRF_CLIENT
)
981 SendMessageW(hwnd
, WM_PRINTCLIENT
, (WPARAM
)hdc
, PRF_CLIENT
);
986 DefWndScreenshot(HWND hWnd
)
993 HDC hdc
= GetWindowDC(hWnd
);
994 GetWindowRect(hWnd
, &rect
);
995 INT w
= rect
.right
- rect
.left
;
996 INT h
= rect
.bottom
- rect
.top
;
998 HBITMAP hbitmap
= CreateCompatibleBitmap(hdc
, w
, h
);
999 HDC hdc2
= CreateCompatibleDC(hdc
);
1000 SelectObject(hdc2
, hbitmap
);
1002 BitBlt(hdc2
, 0, 0, w
, h
,
1006 SetClipboardData(CF_BITMAP
, hbitmap
);
1008 ReleaseDC(hWnd
, hdc
);
1009 ReleaseDC(hWnd
, hdc2
);
1018 User32DefWindowProc(HWND hWnd
,
1028 return DefWndNCPaint(hWnd
, (HRGN
)wParam
, -1);
1033 return DefWndNCCalcSize(hWnd
, (BOOL
)wParam
, (RECT
*)lParam
);
1038 return DefWndNCActivate(hWnd
, wParam
);
1044 Point
.x
= GET_X_LPARAM(lParam
);
1045 Point
.y
= GET_Y_LPARAM(lParam
);
1046 return (DefWndNCHitTest(hWnd
, Point
));
1049 case WM_LBUTTONDOWN
:
1050 case WM_RBUTTONDOWN
:
1051 case WM_MBUTTONDOWN
:
1052 iF10Key
= iMenuSysKey
= 0;
1055 case WM_NCLBUTTONDOWN
:
1057 return (DefWndNCLButtonDown(hWnd
, wParam
, lParam
));
1060 case WM_LBUTTONDBLCLK
:
1061 return (DefWndNCLButtonDblClk(hWnd
, HTCLIENT
, lParam
));
1063 case WM_NCLBUTTONDBLCLK
:
1065 return (DefWndNCLButtonDblClk(hWnd
, wParam
, lParam
));
1068 case WM_WINDOWPOSCHANGING
:
1070 return (DefWndHandleWindowPosChanging(hWnd
, (WINDOWPOS
*)lParam
));
1073 case WM_WINDOWPOSCHANGED
:
1075 return (DefWndHandleWindowPosChanged(hWnd
, (WINDOWPOS
*)lParam
));
1078 case WM_NCRBUTTONDOWN
:
1080 /* in Windows, capture is taken when right-clicking on the caption bar */
1081 if (wParam
== HTCAPTION
)
1091 if (hWnd
== GetCapture())
1095 Pt
.x
= GET_X_LPARAM(lParam
);
1096 Pt
.y
= GET_Y_LPARAM(lParam
);
1097 ClientToScreen(hWnd
, &Pt
);
1098 lParam
= MAKELPARAM(Pt
.x
, Pt
.y
);
1101 SendMessageW(hWnd
, WM_CONTEXTMENU
, (WPARAM
)hWnd
, lParam
);
1105 SendMessageA(hWnd
, WM_CONTEXTMENU
, (WPARAM
)hWnd
, lParam
);
1110 case WM_NCRBUTTONUP
:
1112 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
1113 * in Windows), but what _should_ we do? According to MSDN :
1114 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
1115 * message to the window". When is it appropriate?
1119 case WM_CONTEXTMENU
:
1121 if (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CHILD
)
1125 SendMessageW(GetParent(hWnd
), Msg
, wParam
, lParam
);
1129 SendMessageA(GetParent(hWnd
), WM_CONTEXTMENU
, wParam
, lParam
);
1138 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
1140 Pt
.x
= GET_X_LPARAM(lParam
);
1141 Pt
.y
= GET_Y_LPARAM(lParam
);
1142 if (Style
& WS_CHILD
)
1144 ScreenToClient(GetParent(hWnd
), &Pt
);
1147 HitCode
= DefWndNCHitTest(hWnd
, Pt
);
1149 if (HitCode
== HTCAPTION
|| HitCode
== HTSYSMENU
)
1154 if((SystemMenu
= GetSystemMenu(hWnd
, FALSE
)))
1156 MenuInitSysMenuPopup(SystemMenu
, GetWindowLongW(hWnd
, GWL_STYLE
),
1157 GetClassLongW(hWnd
, GCL_STYLE
), HitCode
);
1159 if(HitCode
== HTCAPTION
)
1160 Flags
= TPM_LEFTBUTTON
| TPM_RIGHTBUTTON
;
1162 Flags
= TPM_LEFTBUTTON
;
1164 TrackPopupMenu(SystemMenu
, Flags
,
1165 Pt
.x
, Pt
.y
, 0, hWnd
, NULL
);
1174 DefWndPrint(hWnd
, (HDC
)wParam
, lParam
);
1182 HDC hDC
= BeginPaint(hWnd
, &Ps
);
1186 if (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_MINIMIZE
&&
1187 (hIcon
= (HICON
)GetClassLongW(hWnd
, GCL_HICON
)) != NULL
)
1191 GetClientRect(hWnd
, &ClientRect
);
1192 x
= (ClientRect
.right
- ClientRect
.left
-
1193 GetSystemMetrics(SM_CXICON
)) / 2;
1194 y
= (ClientRect
.bottom
- ClientRect
.top
-
1195 GetSystemMetrics(SM_CYICON
)) / 2;
1196 DrawIcon(hDC
, x
, y
, hIcon
);
1198 EndPaint(hWnd
, &Ps
);
1206 hRgn
= CreateRectRgn(0, 0, 0, 0);
1207 if (GetUpdateRgn(hWnd
, hRgn
, FALSE
) != NULLREGION
)
1209 RedrawWindow(hWnd
, NULL
, hRgn
,
1210 RDW_ERASENOW
| RDW_ERASE
| RDW_FRAME
|
1219 DefWndSetRedraw(hWnd
, wParam
);
1225 DestroyWindow(hWnd
);
1229 case WM_MOUSEACTIVATE
:
1231 if (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CHILD
)
1236 Ret
= SendMessageW(GetParent(hWnd
), WM_MOUSEACTIVATE
,
1241 Ret
= SendMessageA(GetParent(hWnd
), WM_MOUSEACTIVATE
,
1249 return ((LOWORD(lParam
) >= HTCLIENT
) ? MA_ACTIVATE
: MA_NOACTIVATE
);
1254 /* Check if the window is minimized. */
1255 if (LOWORD(wParam
) != WA_INACTIVE
&&
1256 !(GetWindowLongW(hWnd
, GWL_STYLE
) & WS_MINIMIZE
))
1265 if (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CHILD
)
1269 return (SendMessageW(GetParent(hWnd
), WM_MOUSEWHEEL
,
1274 return (SendMessageA(GetParent(hWnd
), WM_MOUSEWHEEL
,
1282 case WM_ICONERASEBKGND
:
1285 HBRUSH hBrush
= (HBRUSH
)GetClassLongW(hWnd
, GCL_HBRBACKGROUND
);
1291 if (GetClassLongW(hWnd
, GCL_STYLE
) & CS_PARENTDC
)
1293 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1294 GetClientRect(hWnd
, &Rect
);
1295 DPtoLP((HDC
)wParam
, (LPPOINT
)&Rect
, 2);
1299 GetClipBox((HDC
)wParam
, &Rect
);
1301 FillRect((HDC
)wParam
, &Rect
, hBrush
);
1305 case WM_CTLCOLORMSGBOX
:
1306 case WM_CTLCOLOREDIT
:
1307 case WM_CTLCOLORLISTBOX
:
1308 case WM_CTLCOLORBTN
:
1309 case WM_CTLCOLORDLG
:
1310 case WM_CTLCOLORSTATIC
:
1311 case WM_CTLCOLORSCROLLBAR
:
1312 return (LRESULT
) DefWndControlColor((HDC
)wParam
, Msg
- WM_CTLCOLORMSGBOX
);
1315 return (LRESULT
) DefWndControlColor((HDC
)wParam
, HIWORD(lParam
));
1319 ULONG Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
1321 if (Style
& WS_CHILD
)
1323 if (LOWORD(lParam
) < HTLEFT
|| LOWORD(lParam
) > HTBOTTOMRIGHT
)
1328 bResult
= SendMessageW(GetParent(hWnd
), WM_SETCURSOR
,
1333 bResult
= SendMessageA(GetParent(hWnd
), WM_SETCURSOR
,
1342 return (DefWndHandleSetCursor(hWnd
, wParam
, lParam
, Style
));
1346 return (DefWndHandleSysCommand(hWnd
, wParam
, lParam
));
1349 if(wParam
== VK_F10
) iF10Key
= VK_F10
;
1352 /* FIXME: This is also incomplete. */
1355 if (HIWORD(lParam
) & KEYDATA_ALT
)
1357 /* if( HIWORD(lParam) & ~KEYDATA_PREVSTATE ) */
1358 if ( (wParam
== VK_MENU
|| wParam
== VK_LMENU
1359 || wParam
== VK_RMENU
) && !iMenuSysKey
)
1366 if (wParam
== VK_F4
) /* Try to close the window */
1368 HWND top
= GetAncestor(hWnd
, GA_ROOT
);
1369 if (!(GetClassLongW(top
, GCL_STYLE
) & CS_NOCLOSE
))
1372 PostMessageW(top
, WM_SYSCOMMAND
, SC_CLOSE
, 0);
1374 PostMessageA(top
, WM_SYSCOMMAND
, SC_CLOSE
, 0);
1377 else if (wParam
== VK_SNAPSHOT
)
1380 while (GetParent(hwnd
) != NULL
)
1382 hwnd
= GetParent(hwnd
);
1384 DefWndScreenshot(hwnd
);
1387 else if( wParam
== VK_F10
)
1389 else if( wParam
== VK_ESCAPE
&& (GetKeyState(VK_SHIFT
) & 0x8000))
1390 SendMessageW( hWnd
, WM_SYSCOMMAND
, SC_KEYMENU
, ' ' );
1397 /* Press and release F10 or ALT */
1398 if (((wParam
== VK_MENU
|| wParam
== VK_LMENU
|| wParam
== VK_RMENU
)
1399 && iMenuSysKey
) || ((wParam
== VK_F10
) && iF10Key
))
1400 SendMessageW( GetAncestor( hWnd
, GA_ROOT
), WM_SYSCOMMAND
, SC_KEYMENU
, 0L );
1401 iMenuSysKey
= iF10Key
= 0;
1408 if (wParam
== '\r' && IsIconic(hWnd
))
1410 PostMessageW( hWnd
, WM_SYSCOMMAND
, SC_RESTORE
, 0L );
1413 if ((HIWORD(lParam
) & KEYDATA_ALT
) && wParam
)
1415 if (wParam
== '\t' || wParam
== '\x1b') break;
1416 if (wParam
== ' ' && (GetWindowLongW( hWnd
, GWL_STYLE
) & WS_CHILD
))
1417 SendMessageW( GetParent(hWnd
), Msg
, wParam
, lParam
);
1419 SendMessageW( hWnd
, WM_SYSCOMMAND
, SC_KEYMENU
, wParam
);
1421 else /* check for Ctrl-Esc */
1422 if (wParam
!= '\x1b') MessageBeep(0);
1431 if (!lParam
) return 0;
1432 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
1433 if ((Style
& WS_VISIBLE
) && wParam
) return 0;
1434 if (!(Style
& WS_VISIBLE
) && !wParam
) return 0;
1435 if (!GetWindow(hWnd
, GW_OWNER
)) return 0;
1436 Ret
= NtUserCallTwoParam((DWORD
) hWnd
, (DWORD
) wParam
, TWOPARAM_ROUTINE_ROS_SHOWWINDOW
);
1439 if( Ret
== -1) return 0;
1442 ShowWindow(hWnd
, wParam
? SW_SHOWNOACTIVATE
: SW_HIDE
);
1449 /* FIXME: Check for a desktop. */
1450 if (!(GetWindowLongW( hWnd
, GWL_STYLE
) & WS_CHILD
)) EndMenu();
1451 if (GetCapture() == hWnd
)
1465 case WM_QUERYDROPOBJECT
:
1467 if (GetWindowLongW(hWnd
, GWL_EXSTYLE
) & WS_EX_ACCEPTFILES
)
1474 case WM_QUERYDRAGICON
:
1479 hIcon
= (HICON
)GetClassLongW(hWnd
, GCL_HICON
);
1482 return ((LRESULT
)hIcon
);
1484 for (Len
= 1; Len
< 64; Len
++)
1486 if ((hIcon
= LoadIconW(NULL
, MAKEINTRESOURCEW(Len
))) != NULL
)
1488 return((LRESULT
)hIcon
);
1491 return ((LRESULT
)LoadIconW(0, IDI_APPLICATION
));
1494 /* FIXME: WM_ISACTIVEICON */
1496 case WM_NOTIFYFORMAT
:
1498 if (lParam
== NF_QUERY
)
1499 return IsWindowUnicode(hWnd
) ? NFR_UNICODE
: NFR_ANSI
;
1505 INT Index
= (wParam
!= 0) ? GCL_HICON
: GCL_HICONSM
;
1506 HICON hOldIcon
= (HICON
)GetClassLongW(hWnd
, Index
);
1507 SetClassLongW(hWnd
, Index
, lParam
);
1508 SetWindowPos(hWnd
, 0, 0, 0, 0, 0,
1509 SWP_FRAMECHANGED
| SWP_NOSIZE
| SWP_NOMOVE
|
1510 SWP_NOACTIVATE
| SWP_NOZORDER
);
1511 return ((LRESULT
)hOldIcon
);
1516 INT Index
= (wParam
== ICON_BIG
) ? GCL_HICON
: GCL_HICONSM
;
1517 return (GetClassLongW(hWnd
, Index
));
1524 SendMessageW(GetParent(hWnd
), Msg
, wParam
, lParam
);
1528 SendMessageA(GetParent(hWnd
), Msg
, wParam
, lParam
);
1535 THRDCARETINFO CaretInfo
;
1538 case 0xffff: /* Caret timer */
1539 /* switch showing byte in win32k and get information about the caret */
1540 if(NtUserSwitchCaretShowing(&CaretInfo
) && (CaretInfo
.hWnd
== hWnd
))
1542 DrawCaret(hWnd
, &CaretInfo
);
1550 case WM_QUERYENDSESSION
:
1555 case WM_INPUTLANGCHANGEREQUEST
:
1559 if(wParam
& INPUTLANGCHANGE_BACKWARD
1560 && wParam
& INPUTLANGCHANGE_FORWARD
)
1565 //FIXME: What to do with INPUTLANGCHANGE_SYSCHARSET ?
1567 if(wParam
& INPUTLANGCHANGE_BACKWARD
) NewHkl
= (HKL
) HKL_PREV
;
1568 else if(wParam
& INPUTLANGCHANGE_FORWARD
) NewHkl
= (HKL
) HKL_NEXT
;
1569 else NewHkl
= (HKL
) lParam
;
1571 NtUserActivateKeyboardLayout(NewHkl
, 0);
1576 case WM_INPUTLANGCHANGE
:
1578 //FIXME: What to do?
1583 if (wParam
) PostQuitMessage(0);
1592 DefWindowProcA(HWND hWnd
,
1599 SPY_EnterMessage(SPY_DEFWNDPROC
, hWnd
, Msg
, wParam
, lParam
);
1604 ANSI_STRING AnsiString
;
1605 UNICODE_STRING UnicodeString
;
1606 LPCREATESTRUCTA cs
= (LPCREATESTRUCTA
)lParam
;
1607 /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
1608 * may have child window IDs instead of window name */
1612 RtlInitAnsiString(&AnsiString
, (LPSTR
)cs
->lpszName
);
1613 RtlAnsiStringToUnicodeString(&UnicodeString
, &AnsiString
, TRUE
);
1614 NtUserDefSetText(hWnd
, &UnicodeString
);
1615 RtlFreeUnicodeString(&UnicodeString
);
1618 NtUserDefSetText(hWnd
, NULL
);
1624 case WM_GETTEXTLENGTH
:
1626 Result
= (LRESULT
)NtUserInternalGetWindowText(hWnd
, NULL
, 0);
1633 LPSTR AnsiBuffer
= (LPSTR
)lParam
;
1636 Buffer
= HeapAlloc(GetProcessHeap(), 0, wParam
* sizeof(WCHAR
));
1642 Length
= NtUserInternalGetWindowText(hWnd
, Buffer
, wParam
);
1643 if (Length
> 0 && wParam
> 0 &&
1644 !WideCharToMultiByte(CP_ACP
, 0, Buffer
, -1,
1645 AnsiBuffer
, wParam
, NULL
, NULL
))
1647 AnsiBuffer
[0] = '\0';
1650 HeapFree(GetProcessHeap(), 0, Buffer
);
1652 Result
= (LRESULT
)Length
;
1658 ANSI_STRING AnsiString
;
1659 UNICODE_STRING UnicodeString
;
1663 RtlInitAnsiString(&AnsiString
, (LPSTR
)lParam
);
1664 RtlAnsiStringToUnicodeString(&UnicodeString
, &AnsiString
, TRUE
);
1665 NtUserDefSetText(hWnd
, &UnicodeString
);
1666 RtlFreeUnicodeString(&UnicodeString
);
1669 NtUserDefSetText(hWnd
, NULL
);
1671 if ((GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CAPTION
) == WS_CAPTION
)
1673 DefWndNCPaint(hWnd
, (HRGN
)1, -1);
1680 /* FIXME: Implement these. */
1682 case WM_IME_KEYDOWN
:
1684 case WM_IME_STARTCOMPOSITION
:
1685 case WM_IME_COMPOSITION
:
1686 case WM_IME_ENDCOMPOSITION
:
1688 case WM_IME_SETCONTEXT
:
1689 FIXME("FIXME: WM_IME_* conversion isn't implemented yet!");
1692 Result
= User32DefWindowProc(hWnd
, Msg
, wParam
, lParam
, FALSE
);
1695 SPY_ExitMessage(SPY_RESULT_DEFWND
, hWnd
, Msg
, Result
, wParam
, lParam
);
1701 DefWindowProcW(HWND hWnd
,
1708 SPY_EnterMessage(SPY_DEFWNDPROC
, hWnd
, Msg
, wParam
, lParam
);
1713 UNICODE_STRING UnicodeString
;
1714 LPCREATESTRUCTW cs
= (LPCREATESTRUCTW
)lParam
;
1715 /* check for string, as static icons, bitmaps (SS_ICON, SS_BITMAP)
1716 * may have child window IDs instead of window name */
1719 RtlInitUnicodeString(&UnicodeString
, (LPWSTR
)cs
->lpszName
);
1721 NtUserDefSetText( hWnd
, (cs
->lpszName
? &UnicodeString
: NULL
));
1726 case WM_GETTEXTLENGTH
:
1728 Result
= (LRESULT
)NtUserInternalGetWindowText(hWnd
, NULL
, 0);
1734 Result
= (LRESULT
)NtUserInternalGetWindowText(hWnd
, (PWSTR
)lParam
, wParam
);
1740 UNICODE_STRING UnicodeString
;
1743 RtlInitUnicodeString(&UnicodeString
, (LPWSTR
)lParam
);
1745 NtUserDefSetText(hWnd
, (lParam
? &UnicodeString
: NULL
));
1747 if ((GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CAPTION
) == WS_CAPTION
)
1749 DefWndNCPaint(hWnd
, (HRGN
)1, -1);
1757 SendMessageW(hWnd
, WM_CHAR
, wParam
, lParam
);
1762 case WM_IME_SETCONTEXT
:
1765 FIXME("FIXME: WM_IME_SETCONTEXT is not implemented!");
1771 Result
= User32DefWindowProc(hWnd
, Msg
, wParam
, lParam
, TRUE
);
1773 SPY_ExitMessage(SPY_RESULT_DEFWND
, hWnd
, Msg
, Result
, wParam
, lParam
);