2 * ReactOS User32 Library
3 * - Window non-client area management
5 * Copyright (C) 2003 ReactOS Team
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; see the file COPYING.LIB.
19 * If not, write to the Free Software Foundation,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 /* INCLUDES *******************************************************************/
26 * Define this to get the code working on ReactOS. It should be removed later.
29 Already defined in makefile now.
38 #define _WIN32_WINNT 0x0501
46 #include <user32/wininternal.h>
52 #define HAS_DLGFRAME(Style, ExStyle) \
53 (((ExStyle) & WS_EX_DLGMODALFRAME) || \
54 (((Style) & WS_DLGFRAME) && (!((Style) & (WS_THICKFRAME | WS_MINIMIZE)))))
56 #define HAS_THICKFRAME(Style, ExStyle) \
57 (((Style) & WS_THICKFRAME) && !((Style) & WS_MINIMIZE) && \
58 (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
60 #define HAS_THINFRAME(Style, ExStyle) \
61 (((Style) & (WS_BORDER | WS_MINIMIZE)) || (!((Style) & (WS_CHILD | WS_POPUP))))
63 #define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect) \
64 ((!(Style & WS_CHILD) && (Style & WS_THICKFRAME) && !(Style & WS_MAXIMIZE)) || \
65 ((Style & WS_CHILD) && (ParentStyle & WS_THICKFRAME) && !(ParentStyle & WS_MAXIMIZE) && \
66 (WindowRect.right - WindowRect.left == ParentClientRect.right) && \
67 (WindowRect.bottom - WindowRect.top == ParentClientRect.bottom)))
69 * FIXME: This should be moved to a header
72 IntDrawScrollBar(HWND hWnd
, HDC hDC
, INT nBar
);
74 IntScrollHitTest(HWND hWnd
, INT nBar
, POINT pt
, BOOL bDragging
);
76 GetSysColorPen(int nIndex
);
78 extern ATOM AtomInternalPos
;
80 /* PRIVATE FUNCTIONS **********************************************************/
83 UserHasWindowEdge(DWORD Style
, DWORD ExStyle
)
85 if (Style
& WS_MINIMIZE
)
87 if (ExStyle
& WS_EX_DLGMODALFRAME
)
89 if (ExStyle
& WS_EX_STATICEDGE
)
91 if (Style
& WS_THICKFRAME
)
94 if (Style
== WS_DLGFRAME
|| Style
== WS_CAPTION
)
100 UserGetWindowBorders(DWORD Style
, DWORD ExStyle
, SIZE
*Size
, BOOL WithClient
)
104 if (UserHasWindowEdge(Style
, ExStyle
))
106 else if (ExStyle
& WS_EX_STATICEDGE
)
108 if ((ExStyle
& WS_EX_CLIENTEDGE
) && WithClient
)
110 if (Style
& WS_CAPTION
|| ExStyle
& WS_EX_DLGMODALFRAME
)
112 Size
->cx
= Size
->cy
= Border
;
113 if ((Style
& WS_THICKFRAME
) && !(Style
& WS_MINIMIZE
))
115 Size
->cx
+= GetSystemMetrics(SM_CXFRAME
) - GetSystemMetrics(SM_CXDLGFRAME
);
116 Size
->cy
+= GetSystemMetrics(SM_CYFRAME
) - GetSystemMetrics(SM_CYDLGFRAME
);
118 Size
->cx
*= GetSystemMetrics(SM_CXBORDER
);
119 Size
->cy
*= GetSystemMetrics(SM_CYBORDER
);
123 UserHasMenu(HWND hWnd
, ULONG Style
)
125 return (!(Style
& WS_CHILD
) && GetMenu(hWnd
) != 0);
129 UserGetWindowIcon(HWND hwnd
)
133 SendMessageTimeoutW(hwnd
, WM_GETICON
, ICON_SMALL2
, 0, SMTO_ABORTIFHUNG
, 1000, (LPDWORD
)&Ret
);
135 SendMessageTimeoutW(hwnd
, WM_GETICON
, ICON_SMALL
, 0, SMTO_ABORTIFHUNG
, 1000, (LPDWORD
)&Ret
);
137 SendMessageTimeoutW(hwnd
, WM_GETICON
, ICON_BIG
, 0, SMTO_ABORTIFHUNG
, 1000, (LPDWORD
)&Ret
);
139 Ret
= (HICON
)GetClassLongW(hwnd
, GCL_HICONSM
);
141 Ret
= (HICON
)GetClassLongW(hwnd
, GCL_HICON
);
143 SendMessageTimeoutW(hwnd
, WM_QUERYDRAGICON
, 0, 0, 0, 1000, (LPDWORD
)&Ret
);
145 Ret
= LoadIconW(0, IDI_APPLICATION
);
151 UserDrawSysMenuButton(HWND hWnd
, HDC hDC
, LPRECT Rect
)
155 if((WindowIcon
= UserGetWindowIcon(hWnd
)))
157 return DrawIconEx(hDC
, Rect
->left
+ 2, Rect
->top
+ 2, WindowIcon
,
158 GetSystemMetrics(SM_CXSMICON
), GetSystemMetrics(SM_CYSMICON
),
166 * - Cache bitmaps, then just bitblt instead of calling DFC() (and
167 * wasting precious CPU cycles) every time
168 * - Center the buttons verticaly in the rect
171 UserDrawCaptionButton(LPRECT Rect
, DWORD Style
, DWORD ExStyle
, HDC hDC
, BOOL bDown
, ULONG Type
)
175 if (!(Style
& WS_SYSMENU
))
184 case DFCS_CAPTIONMIN
:
186 if (ExStyle
& WS_EX_TOOLWINDOW
)
187 return; /* ToolWindows don't have min/max buttons */
189 if (Style
& WS_SYSMENU
)
190 TempRect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
191 if (Style
& (WS_MAXIMIZEBOX
| WS_MINIMIZEBOX
))
192 TempRect
.right
-= GetSystemMetrics(SM_CXSIZE
) - 2;
193 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXSIZE
) + 1;
194 TempRect
.bottom
= TempRect
.top
+ GetSystemMetrics(SM_CYSIZE
) - 2;
198 DrawFrameControl(hDC
, &TempRect
, DFC_CAPTION
,
199 ((Style
& WS_MINIMIZE
) ? DFCS_CAPTIONRESTORE
: DFCS_CAPTIONMIN
) |
200 (bDown
? DFCS_PUSHED
: 0) |
201 ((Style
& WS_MINIMIZEBOX
) ? 0 : DFCS_INACTIVE
));
204 case DFCS_CAPTIONMAX
:
206 if (ExStyle
& WS_EX_TOOLWINDOW
)
207 return; /* ToolWindows don't have min/max buttons */
209 if (Style
& WS_SYSMENU
)
210 TempRect
.right
-= GetSystemMetrics(SM_CXSIZE
) + 1;
211 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXSIZE
) + 1;
212 TempRect
.bottom
= TempRect
.top
+ GetSystemMetrics(SM_CYSIZE
) - 2;
216 DrawFrameControl(hDC
, &TempRect
, DFC_CAPTION
,
217 ((Style
& WS_MAXIMIZE
) ? DFCS_CAPTIONRESTORE
: DFCS_CAPTIONMAX
) |
218 (bDown
? DFCS_PUSHED
: 0) |
219 ((Style
& WS_MAXIMIZEBOX
) ? 0 : DFCS_INACTIVE
));
222 case DFCS_CAPTIONCLOSE
:
224 /* FIXME: A tool window has a smaller Close button */
226 if (ExStyle
& WS_EX_TOOLWINDOW
)
228 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXSMSIZE
);
229 TempRect
.bottom
= TempRect
.top
+ GetSystemMetrics(SM_CYSMSIZE
) - 2;
233 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXSIZE
);
234 TempRect
.bottom
= TempRect
.top
+ GetSystemMetrics(SM_CYSIZE
) - 2;
239 DrawFrameControl(hDC
, &TempRect
, DFC_CAPTION
,
240 (DFCS_CAPTIONCLOSE
| (bDown
? DFCS_PUSHED
: 0) |
241 ((Style
& WS_SYSMENU
) ? 0 : DFCS_INACTIVE
)));
248 UserDrawCaptionButtonWnd(HWND hWnd
, HDC hDC
, BOOL bDown
, ULONG Type
)
252 DWORD Style
, ExStyle
;
254 GetWindowRect(hWnd
, &WindowRect
);
255 WindowRect
.right
-= WindowRect
.left
;
256 WindowRect
.bottom
-= WindowRect
.top
;
257 WindowRect
.left
= WindowRect
.top
= 0;
258 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
259 ExStyle
= GetWindowLongW(hWnd
, GWL_EXSTYLE
);
260 UserGetWindowBorders(Style
, ExStyle
, &WindowBorder
, FALSE
);
261 InflateRect(&WindowRect
, -WindowBorder
.cx
, -WindowBorder
.cy
);
262 UserDrawCaptionButton(&WindowRect
, Style
, ExStyle
, hDC
, bDown
, Type
);
267 * - Drawing of WS_BORDER after scrollbars
268 * - Correct drawing of size-box
271 DefWndNCPaint(HWND hWnd
, HRGN hRgn
)
275 DWORD Style
, ExStyle
;
277 RECT ClientRect
, WindowRect
, CurrentRect
, TempRect
;
279 if (!IsWindowVisible(hWnd
))
282 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
284 hDC
= GetDCEx(hWnd
, hRgn
, DCX_WINDOW
| DCX_INTERSECTRGN
| 0x10000);
290 Parent
= GetParent(hWnd
);
291 ExStyle
= GetWindowLongW(hWnd
, GWL_EXSTYLE
);
292 if (ExStyle
& WS_EX_MDICHILD
)
294 Active
= IsChild(GetForegroundWindow(), hWnd
);
296 Active
= (hWnd
== (HWND
)SendMessageW(Parent
, WM_MDIGETACTIVE
, 0, 0));
300 Active
= (GetForegroundWindow() == hWnd
);
302 GetWindowRect(hWnd
, &WindowRect
);
303 GetClientRect(hWnd
, &ClientRect
);
305 CurrentRect
.top
= CurrentRect
.left
= 0;
306 CurrentRect
.right
= WindowRect
.right
- WindowRect
.left
;
307 CurrentRect
.bottom
= WindowRect
.bottom
- WindowRect
.top
;
309 /* Draw outer edge */
310 if (UserHasWindowEdge(Style
, ExStyle
))
312 DrawEdge(hDC
, &CurrentRect
, EDGE_RAISED
, BF_RECT
| BF_ADJUST
);
314 if (ExStyle
& WS_EX_STATICEDGE
)
316 DrawEdge(hDC
, &CurrentRect
, BDR_SUNKENINNER
, BF_RECT
| BF_ADJUST
| BF_FLAT
);
319 /* Firstly the "thick" frame */
320 if ((Style
& WS_THICKFRAME
) && !(Style
& WS_MINIMIZE
))
323 (GetSystemMetrics(SM_CXFRAME
) - GetSystemMetrics(SM_CXDLGFRAME
)) *
324 GetSystemMetrics(SM_CXBORDER
);
326 (GetSystemMetrics(SM_CYFRAME
) - GetSystemMetrics(SM_CYDLGFRAME
)) *
327 GetSystemMetrics(SM_CYBORDER
);
329 SelectObject(hDC
, GetSysColorBrush(Active
? COLOR_ACTIVEBORDER
:
330 COLOR_INACTIVEBORDER
));
333 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.top
, CurrentRect
.right
- CurrentRect
.left
, Height
, PATCOPY
);
334 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.top
, Width
, CurrentRect
.bottom
- CurrentRect
.top
, PATCOPY
);
336 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.bottom
- 1, CurrentRect
.right
- CurrentRect
.left
, -Height
, PATCOPY
);
337 PatBlt(hDC
, CurrentRect
.right
- 1, CurrentRect
.top
, -Width
, CurrentRect
.bottom
- CurrentRect
.top
, PATCOPY
);
339 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.bottom
, CurrentRect
.right
- CurrentRect
.left
, -Height
, PATCOPY
);
340 PatBlt(hDC
, CurrentRect
.right
, CurrentRect
.top
, -Width
, CurrentRect
.bottom
- CurrentRect
.top
, PATCOPY
);
343 InflateRect(&CurrentRect
, -Width
, -Height
);
346 /* Now the other bit of the frame */
347 if (Style
& WS_CAPTION
|| ExStyle
& WS_EX_DLGMODALFRAME
)
349 DWORD Width
= GetSystemMetrics(SM_CXBORDER
);
350 DWORD Height
= GetSystemMetrics(SM_CYBORDER
);
352 SelectObject(hDC
, GetSysColorBrush(
353 (ExStyle
& (WS_EX_DLGMODALFRAME
| WS_EX_CLIENTEDGE
)) ? COLOR_3DFACE
:
354 (ExStyle
& WS_EX_STATICEDGE
) ? COLOR_WINDOWFRAME
:
355 (Style
& (WS_DLGFRAME
| WS_THICKFRAME
)) ? COLOR_3DFACE
:
359 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.top
, CurrentRect
.right
- CurrentRect
.left
, Height
, PATCOPY
);
360 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.top
, Width
, CurrentRect
.bottom
- CurrentRect
.top
, PATCOPY
);
362 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.bottom
- 1, CurrentRect
.right
- CurrentRect
.left
, -Height
, PATCOPY
);
363 PatBlt(hDC
, CurrentRect
.right
- 1, CurrentRect
.top
, -Width
, CurrentRect
.bottom
- CurrentRect
.top
, PATCOPY
);
365 PatBlt(hDC
, CurrentRect
.left
, CurrentRect
.bottom
, CurrentRect
.right
- CurrentRect
.left
, -Height
, PATCOPY
);
366 PatBlt(hDC
, CurrentRect
.right
, CurrentRect
.top
, -Width
, CurrentRect
.bottom
- CurrentRect
.top
, PATCOPY
);
369 InflateRect(&CurrentRect
, -Width
, -Height
);
373 if ((Style
& WS_CAPTION
) == WS_CAPTION
)
375 DWORD CaptionFlags
= DC_ICON
| DC_TEXT
| DC_BUTTONS
;
377 BOOL Gradient
= FALSE
;
379 if(SystemParametersInfoW(SPI_GETGRADIENTCAPTIONS
, 0, &Gradient
, 0) && Gradient
)
381 CaptionFlags
|= DC_GRADIENT
;
384 TempRect
= CurrentRect
;
388 CaptionFlags
|= DC_ACTIVE
;
391 if (ExStyle
& WS_EX_TOOLWINDOW
)
393 CaptionFlags
|= DC_SMALLCAP
;
394 TempRect
.bottom
= TempRect
.top
+ GetSystemMetrics(SM_CYSMCAPTION
) - 1;
395 CurrentRect
.top
+= GetSystemMetrics(SM_CYSMCAPTION
);
399 TempRect
.bottom
= TempRect
.top
+ GetSystemMetrics(SM_CYCAPTION
) - 1;
400 CurrentRect
.top
+= GetSystemMetrics(SM_CYCAPTION
);
403 DrawCaption(hWnd
, hDC
, &TempRect
, CaptionFlags
);
406 if (Style
& WS_SYSMENU
)
408 UserDrawCaptionButton(&TempRect
, Style
, ExStyle
, hDC
, FALSE
, DFCS_CAPTIONCLOSE
);
409 if ((Style
& (WS_MAXIMIZEBOX
| WS_MINIMIZEBOX
)) && !(ExStyle
& WS_EX_TOOLWINDOW
))
411 UserDrawCaptionButton(&TempRect
, Style
, ExStyle
, hDC
, FALSE
, DFCS_CAPTIONMIN
);
412 UserDrawCaptionButton(&TempRect
, Style
, ExStyle
, hDC
, FALSE
, DFCS_CAPTIONMAX
);
415 if(!(Style
& WS_MINIMIZE
))
417 /* Line under caption */
418 PreviousPen
= SelectObject(hDC
, GetSysColorPen(
419 ((ExStyle
& (WS_EX_STATICEDGE
| WS_EX_CLIENTEDGE
|
420 WS_EX_DLGMODALFRAME
)) == WS_EX_STATICEDGE
) ?
421 COLOR_WINDOWFRAME
: COLOR_3DFACE
));
422 MoveToEx(hDC
, TempRect
.left
, TempRect
.bottom
, NULL
);
423 LineTo(hDC
, TempRect
.right
, TempRect
.bottom
);
424 SelectObject(hDC
, PreviousPen
);
428 if(!(Style
& WS_MINIMIZE
))
430 HMENU menu
= GetMenu(hWnd
);
432 if (menu
&& !(Style
& WS_CHILD
))
434 TempRect
= CurrentRect
;
435 TempRect
.bottom
= TempRect
.top
+ (UINT
)NtUserSetMenuBarHeight(menu
, 0);
436 CurrentRect
.top
+= MenuDrawMenuBar(hDC
, &TempRect
, hWnd
, TRUE
);
439 if (ExStyle
& WS_EX_CLIENTEDGE
)
441 DrawEdge(hDC
, &CurrentRect
, EDGE_SUNKEN
, BF_RECT
| BF_ADJUST
);
444 /* Draw the scrollbars */
445 if ((Style
& WS_VSCROLL
) && (Style
& WS_HSCROLL
) &&
446 (CurrentRect
.bottom
- CurrentRect
.top
) > GetSystemMetrics(SM_CYHSCROLL
))
448 RECT ParentClientRect
;
450 TempRect
= CurrentRect
;
451 if (ExStyle
& WS_EX_LEFTSCROLLBAR
)
452 TempRect
.right
= TempRect
.left
+ GetSystemMetrics(SM_CXVSCROLL
);
454 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXVSCROLL
);
455 TempRect
.top
= TempRect
.bottom
- GetSystemMetrics(SM_CYHSCROLL
);
456 FillRect(hDC
, &TempRect
, GetSysColorBrush(COLOR_SCROLLBAR
));
457 /* FIXME: Correct drawing of size-box with WS_EX_LEFTSCROLLBAR */
459 GetClientRect(Parent
, &ParentClientRect
);
460 if (HASSIZEGRIP(Style
, ExStyle
, GetWindowLongW(Parent
, GWL_STYLE
), WindowRect
, ParentClientRect
))
462 DrawFrameControl(hDC
, &TempRect
, DFC_SCROLL
, DFCS_SCROLLSIZEGRIP
);
464 IntDrawScrollBar(hWnd
, hDC
, SB_VERT
);
465 IntDrawScrollBar(hWnd
, hDC
, SB_HORZ
);
469 if (Style
& WS_VSCROLL
)
470 IntDrawScrollBar(hWnd
, hDC
, SB_VERT
);
471 else if (Style
& WS_HSCROLL
)
472 IntDrawScrollBar(hWnd
, hDC
, SB_HORZ
);
476 ReleaseDC(hWnd
, hDC
);
482 DefWndNCCalcSize(HWND hWnd
, BOOL CalcSizeStruct
, RECT
*Rect
)
485 DWORD Style
= GetClassLongW(hWnd
, GCL_STYLE
);
488 RECT OrigRect
= *Rect
;
492 if (Style
& CS_VREDRAW
)
494 Result
|= WVR_VREDRAW
;
496 if (Style
& CS_HREDRAW
)
498 Result
|= WVR_HREDRAW
;
500 Result
|= WVR_VALIDRECTS
;
503 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
504 ExStyle
= GetWindowLongW(hWnd
, GWL_EXSTYLE
);
506 if (!(Style
& WS_MINIMIZE
))
509 HMENU menu
= GetMenu(hWnd
);
511 UserGetWindowBorders(Style
, ExStyle
, &WindowBorders
, FALSE
);
512 InflateRect(Rect
, -WindowBorders
.cx
, -WindowBorders
.cy
);
513 if ((Style
& WS_CAPTION
) == WS_CAPTION
)
515 if (ExStyle
& WS_EX_TOOLWINDOW
)
516 Rect
->top
+= GetSystemMetrics(SM_CYSMCAPTION
);
518 Rect
->top
+= GetSystemMetrics(SM_CYCAPTION
);
521 if (menu
&& !(Style
& WS_CHILD
))
523 HDC hDC
= GetWindowDC(hWnd
);
526 RECT CliRect
= *Rect
;
527 CliRect
.bottom
-= OrigRect
.top
;
528 CliRect
.right
-= OrigRect
.left
;
529 CliRect
.left
-= OrigRect
.left
;
530 CliRect
.top
-= OrigRect
.top
;
531 menuheight
= (ULONG
)MenuDrawMenuBar(hDC
, &CliRect
, hWnd
, FALSE
);
532 ReleaseDC(hWnd
, hDC
);
533 Rect
->top
+= max(menuheight
, GetSystemMetrics(SM_CYMENU
));
537 if (ExStyle
& WS_EX_CLIENTEDGE
)
539 InflateRect(Rect
, -2 * GetSystemMetrics(SM_CXBORDER
),
540 -2 * GetSystemMetrics(SM_CYBORDER
));
543 if ((Style
& WS_VSCROLL
) && (Style
& WS_HSCROLL
) &&
544 (Rect
->bottom
- Rect
->top
) > GetSystemMetrics(SM_CYHSCROLL
))
546 if ((ExStyle
& WS_EX_LEFTSCROLLBAR
) != 0)
547 Rect
->left
+= GetSystemMetrics(SM_CXVSCROLL
);
549 Rect
->right
-= GetSystemMetrics(SM_CXVSCROLL
);
550 Rect
->bottom
-= GetSystemMetrics(SM_CYHSCROLL
);
554 if (Style
& WS_VSCROLL
)
556 if ((ExStyle
& WS_EX_LEFTSCROLLBAR
) != 0)
557 Rect
->left
+= GetSystemMetrics(SM_CXVSCROLL
);
559 Rect
->right
-= GetSystemMetrics(SM_CXVSCROLL
);
561 else if (Style
& WS_HSCROLL
)
562 Rect
->bottom
-= GetSystemMetrics(SM_CYHSCROLL
);
564 if (Rect
->top
> Rect
->bottom
)
565 Rect
->bottom
= Rect
->top
;
566 if (Rect
->left
> Rect
->right
)
567 Rect
->right
= Rect
->left
;
571 Rect
->right
= Rect
->left
;
572 Rect
->bottom
= Rect
->top
;
579 DefWndNCActivate(HWND hWnd
, WPARAM wParam
)
581 DefWndNCPaint(hWnd
, (HRGN
)1);
587 * - Check the scrollbar handling
590 DefWndNCHitTest(HWND hWnd
, POINT Point
)
592 RECT WindowRect
, ClientRect
, OrigWndRect
;
595 ULONG Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
596 ULONG ExStyle
= GetWindowLongW(hWnd
, GWL_EXSTYLE
);
598 GetWindowRect(hWnd
, &WindowRect
);
599 if (!PtInRect(&WindowRect
, Point
))
603 OrigWndRect
= WindowRect
;
605 if (UserHasWindowEdge(Style
, ExStyle
))
609 UserGetWindowBorders(Style
, ExStyle
, &WindowBorders
, FALSE
);
610 InflateRect(&WindowRect
, -WindowBorders
.cx
, -WindowBorders
.cy
);
611 XSize
= GetSystemMetrics(SM_CXSIZE
) * GetSystemMetrics(SM_CXBORDER
);
612 YSize
= GetSystemMetrics(SM_CYSIZE
) * GetSystemMetrics(SM_CYBORDER
);
613 if (!PtInRect(&WindowRect
, Point
))
617 ThickFrame
= (Style
& WS_THICKFRAME
);
618 if (Point
.y
< WindowRect
.top
)
620 if(Style
& WS_MINIMIZE
)
624 if (Point
.x
< (WindowRect
.left
+ XSize
))
626 if (Point
.x
>= (WindowRect
.right
- XSize
))
630 if (Point
.y
>= WindowRect
.bottom
)
632 if(Style
& WS_MINIMIZE
)
636 if (Point
.x
< (WindowRect
.left
+ XSize
))
638 if (Point
.x
>= (WindowRect
.right
- XSize
))
639 return HTBOTTOMRIGHT
;
642 if (Point
.x
< WindowRect
.left
)
644 if(Style
& WS_MINIMIZE
)
648 if (Point
.y
< (WindowRect
.top
+ YSize
))
650 if (Point
.y
>= (WindowRect
.bottom
- YSize
))
654 if (Point
.x
>= WindowRect
.right
)
656 if(Style
& WS_MINIMIZE
)
660 if (Point
.y
< (WindowRect
.top
+ YSize
))
662 if (Point
.y
>= (WindowRect
.bottom
- YSize
))
663 return HTBOTTOMRIGHT
;
670 if (ExStyle
& WS_EX_STATICEDGE
)
671 InflateRect(&WindowRect
,
672 -GetSystemMetrics(SM_CXBORDER
),
673 -GetSystemMetrics(SM_CYBORDER
));
674 if (!PtInRect(&WindowRect
, Point
))
678 if ((Style
& WS_CAPTION
) == WS_CAPTION
)
680 if (ExStyle
& WS_EX_TOOLWINDOW
)
681 WindowRect
.top
+= GetSystemMetrics(SM_CYSMCAPTION
);
683 WindowRect
.top
+= GetSystemMetrics(SM_CYCAPTION
);
684 if (!PtInRect(&WindowRect
, Point
))
686 if (Style
& WS_SYSMENU
)
688 if (ExStyle
& WS_EX_TOOLWINDOW
)
690 WindowRect
.right
-= GetSystemMetrics(SM_CXSMSIZE
);
694 WindowRect
.left
+= GetSystemMetrics(SM_CXSIZE
);
695 WindowRect
.right
-= GetSystemMetrics(SM_CXSIZE
);
698 if (Point
.x
<= WindowRect
.left
)
700 if (WindowRect
.right
<= Point
.x
)
702 if (Style
& WS_MAXIMIZEBOX
|| Style
& WS_MINIMIZEBOX
)
703 WindowRect
.right
-= GetSystemMetrics(SM_CXSIZE
);
704 if (Point
.x
>= WindowRect
.right
)
706 if (Style
& WS_MINIMIZEBOX
)
707 WindowRect
.right
-= GetSystemMetrics(SM_CXSIZE
);
708 if (Point
.x
>= WindowRect
.right
)
714 if(!(Style
& WS_MINIMIZE
))
719 ScreenToClient(hWnd
, &ClientPoint
);
720 GetClientRect(hWnd
, &ClientRect
);
722 if (PtInRect(&ClientRect
, ClientPoint
))
727 if ((menu
= GetMenu(hWnd
)) && !(Style
& WS_CHILD
))
729 if (Point
.x
> 0 && Point
.x
< WindowRect
.right
&& ClientPoint
.y
< 0)
733 if (ExStyle
& WS_EX_CLIENTEDGE
)
735 InflateRect(&WindowRect
, -2 * GetSystemMetrics(SM_CXBORDER
),
736 -2 * GetSystemMetrics(SM_CYBORDER
));
739 if ((Style
& WS_VSCROLL
) && (Style
& WS_HSCROLL
) &&
740 (WindowRect
.bottom
- WindowRect
.top
) > GetSystemMetrics(SM_CYHSCROLL
))
742 RECT ParentRect
, TempRect
= WindowRect
, TempRect2
= WindowRect
;
743 HWND Parent
= GetParent(hWnd
);
745 TempRect
.bottom
-= GetSystemMetrics(SM_CYHSCROLL
);
746 if ((ExStyle
& WS_EX_LEFTSCROLLBAR
) != 0)
747 TempRect
.right
= TempRect
.left
+ GetSystemMetrics(SM_CXVSCROLL
);
749 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXVSCROLL
);
750 if (PtInRect(&TempRect
, Point
))
753 TempRect2
.top
= TempRect2
.bottom
- GetSystemMetrics(SM_CYHSCROLL
);
754 if ((ExStyle
& WS_EX_LEFTSCROLLBAR
) != 0)
755 TempRect2
.left
+= GetSystemMetrics(SM_CXVSCROLL
);
757 TempRect2
.right
-= GetSystemMetrics(SM_CXVSCROLL
);
758 if (PtInRect(&TempRect2
, Point
))
761 TempRect
.top
= TempRect2
.top
;
762 TempRect
.bottom
= TempRect2
.bottom
;
764 GetClientRect(Parent
, &ParentRect
);
765 if (PtInRect(&TempRect
, Point
) && HASSIZEGRIP(Style
, ExStyle
,
766 GetWindowLongW(Parent
, GWL_STYLE
), OrigWndRect
, ParentRect
))
768 if ((ExStyle
& WS_EX_LEFTSCROLLBAR
) != 0)
771 return HTBOTTOMRIGHT
;
776 if (Style
& WS_VSCROLL
)
778 RECT TempRect
= WindowRect
;
780 if ((ExStyle
& WS_EX_LEFTSCROLLBAR
) != 0)
781 TempRect
.right
= TempRect
.left
+ GetSystemMetrics(SM_CXVSCROLL
);
783 TempRect
.left
= TempRect
.right
- GetSystemMetrics(SM_CXVSCROLL
);
784 if (PtInRect(&TempRect
, Point
))
787 if (Style
& WS_HSCROLL
)
789 RECT TempRect
= WindowRect
;
790 TempRect
.top
= TempRect
.bottom
- GetSystemMetrics(SM_CYHSCROLL
);
791 if (PtInRect(&TempRect
, Point
))
801 DefWndDoButton(HWND hWnd
, WPARAM wParam
)
804 BOOL InBtn
, HasBtn
= FALSE
;
806 WPARAM SCMsg
, CurBtn
= wParam
, OrigBtn
= wParam
;
809 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
813 Btn
= DFCS_CAPTIONCLOSE
;
815 HasBtn
= (Style
& WS_SYSMENU
);
818 Btn
= DFCS_CAPTIONMIN
;
819 SCMsg
= ((Style
& WS_MINIMIZE
) ? SC_RESTORE
: SC_MINIMIZE
);
820 HasBtn
= (Style
& WS_MINIMIZEBOX
);
823 Btn
= DFCS_CAPTIONMAX
;
824 SCMsg
= ((Style
& WS_MAXIMIZE
) ? SC_RESTORE
: SC_MAXIMIZE
);
825 HasBtn
= (Style
& WS_MAXIMIZEBOX
);
837 WindowDC
= GetWindowDC(hWnd
);
838 UserDrawCaptionButtonWnd(hWnd
, WindowDC
, HasBtn
, Btn
);
843 GetMessageW(&Msg
, 0, 0, 0);
854 ReleaseDC(hWnd
, WindowDC
);
861 CurBtn
= DefWndNCHitTest(hWnd
, Msg
.pt
);
862 if(InBtn
!= (CurBtn
== OrigBtn
))
864 UserDrawCaptionButtonWnd( hWnd
, WindowDC
, (CurBtn
== OrigBtn
) , Btn
);
866 InBtn
= CurBtn
== OrigBtn
;
873 UserDrawCaptionButtonWnd( hWnd
, WindowDC
, FALSE
, Btn
);
874 ReleaseDC(hWnd
, WindowDC
);
876 SendMessageW(hWnd
, WM_SYSCOMMAND
, SCMsg
, 0);
882 DefWndNCLButtonDown(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
888 HWND hTopWnd
= GetAncestor(hWnd
, GA_ROOT
);
889 if (SetActiveWindow(hTopWnd
) || GetActiveWindow() == hTopWnd
)
891 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
897 if (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_SYSMENU
)
899 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
+ HTSYSMENU
,
906 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
+ HTMENU
, lParam
);
911 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
916 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
923 DefWndDoButton(hWnd
, wParam
);
937 if(wParam
== HTBOTTOMRIGHT
&& (Parent
= GetParent(hWnd
)) &&
938 (GetWindowLongW(hWnd
, GWL_STYLE
) & WS_CHILD
) &&
939 !(GetWindowLongW(hWnd
, GWL_EXSTYLE
) & WS_EX_MDICHILD
) &&
940 !(GetWindowLongW(Parent
, GWL_STYLE
) & WS_MAXIMIZE
))
942 SendMessageW(Parent
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- 2, lParam
);
945 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- 2, lParam
);
954 DefWndNCLButtonDblClk(HWND hWnd
, WPARAM wParam
, LPARAM lParam
)
958 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
963 /* Maximize/Restore the window */
964 if((Style
& WS_CAPTION
) && (Style
& WS_MAXIMIZEBOX
))
966 SendMessageW(hWnd
, WM_SYSCOMMAND
, ((Style
& (WS_MINIMIZE
| WS_MAXIMIZE
)) ? SC_RESTORE
: SC_MAXIMIZE
), 0);
972 SendMessageW(hWnd
, WM_SYSCOMMAND
, SC_CLOSE
, 0);
976 return DefWndNCLButtonDown(hWnd
, wParam
, lParam
);
982 DefWndTrackScrollBar(HWND hWnd
, WPARAM wParam
, POINT Point
)
986 if ((wParam
& 0xfff0) == SC_HSCROLL
)
988 if ((wParam
& 0x0f) != HTHSCROLL
)
994 if ((wParam
& 0x0f) != HTVSCROLL
)
1002 /* PUBLIC FUNCTIONS ***********************************************************/
1008 AdjustWindowRectEx(LPRECT lpRect
,
1017 lpRect
->top
-= GetSystemMetrics(SM_CYMENU
);
1019 if ((dwStyle
& WS_CAPTION
) == WS_CAPTION
)
1021 if (dwExStyle
& WS_EX_TOOLWINDOW
)
1022 lpRect
->top
-= GetSystemMetrics(SM_CYSMCAPTION
);
1024 lpRect
->top
-= GetSystemMetrics(SM_CYCAPTION
);
1026 UserGetWindowBorders(dwStyle
, dwExStyle
, &BorderSize
, TRUE
);
1040 AdjustWindowRect(LPRECT lpRect
,
1044 return AdjustWindowRectEx(lpRect
, dwStyle
, bMenu
, 0);
1047 // Enabling this will cause captions to draw smoother, but slower:
1048 #define DOUBLE_BUFFER_CAPTION
1054 DrawCaption(HWND hWnd
, HDC hDC
, LPCRECT lprc
, UINT uFlags
)
1056 NONCLIENTMETRICSW nclm
;
1057 BOOL result
= FALSE
;
1059 UINT VCenter
= 0, Padding
= 0, Height
;
1063 HFONT hOldFont
= NULL
;
1064 HBRUSH OldBrush
= NULL
;
1067 COLORREF OldTextColor
;
1069 #ifdef DOUBLE_BUFFER_CAPTION
1070 HBITMAP MemBMP
= NULL
, OldBMP
= NULL
;
1072 MemDC
= CreateCompatibleDC(hDC
);
1073 if (! MemDC
) goto cleanup
;
1074 MemBMP
= CreateCompatibleBitmap(hDC
, lprc
->right
- lprc
->left
, lprc
->bottom
- lprc
->top
);
1075 if (! MemBMP
) goto cleanup
;
1076 OldBMP
= SelectObject(MemDC
, MemBMP
);
1077 if (! OldBMP
) goto cleanup
;
1081 OffsetViewportOrgEx(MemDC
, lprc
->left
, lprc
->top
, NULL
);
1084 Style
= GetWindowLongW(hWnd
, GWL_STYLE
);
1086 /* Windows behaves like this */
1087 Height
= GetSystemMetrics(SM_CYCAPTION
) - 1;
1089 VCenter
= (lprc
->bottom
- lprc
->top
) / 2;
1090 Padding
= VCenter
- (Height
/ 2);
1093 r
.right
= r
.left
+ (lprc
->right
- lprc
->left
);
1095 r
.bottom
= r
.top
+ (Height
/ 2);
1097 // Draw the caption background
1098 if (uFlags
& DC_INBUTTON
)
1100 OldBrush
= SelectObject(MemDC
, GetSysColorBrush(uFlags
& DC_ACTIVE
? COLOR_BTNFACE
: COLOR_BTNSHADOW
) );
1101 if (! OldBrush
) goto cleanup
;
1102 if (! PatBlt(MemDC
, 0, 0, lprc
->right
- lprc
->left
, lprc
->bottom
- lprc
->top
, PATCOPY
)) goto cleanup
;
1106 if (uFlags
& DC_GRADIENT
)
1108 static GRADIENT_RECT gcap
= {0, 1};
1113 r
.right
= (lprc
->right
- lprc
->left
);
1114 if (uFlags
& DC_SMALLCAP
)
1115 ButtonWidth
= GetSystemMetrics(SM_CXSMSIZE
) - 2;
1117 ButtonWidth
= GetSystemMetrics(SM_CXSIZE
) - 2;
1119 if (Style
& WS_SYSMENU
)
1121 r
.right
-= 3 + ButtonWidth
;
1122 if (! (uFlags
& DC_SMALLCAP
))
1124 if(Style
& (WS_MAXIMIZEBOX
| WS_MINIMIZEBOX
))
1125 r
.right
-= 2 + 2 * ButtonWidth
;
1132 Colors
[0] = GetSysColor((uFlags
& DC_ACTIVE
) ? COLOR_ACTIVECAPTION
: COLOR_INACTIVECAPTION
);
1133 Colors
[1] = GetSysColor((uFlags
& DC_ACTIVE
) ? COLOR_GRADIENTACTIVECAPTION
: COLOR_GRADIENTINACTIVECAPTION
);
1135 if ((uFlags
& DC_ICON
) && (Style
& WS_SYSMENU
) && !(uFlags
& DC_SMALLCAP
))
1137 OldBrush
= SelectObject(MemDC
, GetSysColorBrush(uFlags
& DC_ACTIVE
? COLOR_ACTIVECAPTION
: COLOR_INACTIVECAPTION
));
1138 if (!OldBrush
) goto cleanup
;
1139 xx
= GetSystemMetrics(SM_CXSIZE
) + Padding
;
1140 /* draw icon background */
1141 PatBlt(MemDC
, 0, 0, xx
, lprc
->bottom
- lprc
->top
, PATCOPY
);
1142 // For some reason the icon isn't centered correctly...
1144 UserDrawSysMenuButton(hWnd
, MemDC
, &r
);
1151 vert
[0].Red
= GetRValue(Colors
[0]) << 8;
1152 vert
[0].Green
= GetGValue(Colors
[0]) << 8;
1153 vert
[0].Blue
= GetBValue(Colors
[0]) << 8;
1156 vert
[1].x
= r
.right
;
1157 vert
[1].y
= lprc
->bottom
- lprc
->top
;
1158 vert
[1].Red
= GetRValue(Colors
[1]) << 8;
1159 vert
[1].Green
= GetGValue(Colors
[1]) << 8;
1160 vert
[1].Blue
= GetBValue(Colors
[1]) << 8;
1163 GdiGradientFill(MemDC
, vert
, 2, &gcap
, 1, GRADIENT_FILL_RECT_H
);
1167 SelectObject(MemDC
, OldBrush
);
1170 xx
= lprc
->right
- lprc
->left
- r
.right
;
1173 OldBrush
= SelectObject(MemDC
, GetSysColorBrush(uFlags
& DC_ACTIVE
? COLOR_GRADIENTACTIVECAPTION
: COLOR_GRADIENTINACTIVECAPTION
));
1174 if (!OldBrush
) goto cleanup
;
1175 PatBlt(MemDC
, r
.right
, 0, xx
, lprc
->bottom
- lprc
->top
, PATCOPY
);
1180 OldBrush
= SelectObject(MemDC
, GetSysColorBrush(uFlags
& DC_ACTIVE
? COLOR_ACTIVECAPTION
: COLOR_INACTIVECAPTION
) );
1181 if (! OldBrush
) goto cleanup
;
1182 if (! PatBlt(MemDC
, 0, 0, lprc
->right
- lprc
->left
, lprc
->bottom
- lprc
->top
, PATCOPY
)) goto cleanup
;
1186 if ((uFlags
& DC_ICON
) && !(uFlags
& DC_GRADIENT
) && (Style
& WS_SYSMENU
) && !(uFlags
& DC_SMALLCAP
))
1188 // For some reason the icon isn't centered correctly...
1190 UserDrawSysMenuButton(hWnd
, MemDC
, &r
);
1196 r
.bottom
= r
.top
+ Height
;
1198 if ((uFlags
& DC_TEXT
) && (GetWindowTextW( hWnd
, buffer
, sizeof(buffer
)/sizeof(buffer
[0]) )))
1200 if(!(uFlags
& DC_GRADIENT
))
1202 if (!(uFlags
& DC_SMALLCAP
) && ((uFlags
& DC_ICON
) || (uFlags
& DC_INBUTTON
)))
1203 r
.left
+= GetSystemMetrics(SM_CXSIZE
) + Padding
;
1205 r
.right
= (lprc
->right
- lprc
->left
);
1206 if (uFlags
& DC_SMALLCAP
)
1207 ButtonWidth
= GetSystemMetrics(SM_CXSMSIZE
) - 2;
1209 ButtonWidth
= GetSystemMetrics(SM_CXSIZE
) - 2;
1211 if (Style
& WS_SYSMENU
)
1213 r
.right
-= 3 + ButtonWidth
;
1214 if (! (uFlags
& DC_SMALLCAP
))
1216 if(Style
& (WS_MAXIMIZEBOX
| WS_MINIMIZEBOX
))
1217 r
.right
-= 2 + 2 * ButtonWidth
;
1225 nclm
.cbSize
= sizeof(nclm
);
1226 if (! SystemParametersInfoW(SPI_GETNONCLIENTMETRICS
, sizeof(NONCLIENTMETRICSW
), &nclm
, 0)) goto cleanup
;
1228 SetBkMode( MemDC
, TRANSPARENT
);
1229 if (uFlags
& DC_SMALLCAP
)
1230 hFont
= CreateFontIndirectW(&nclm
.lfSmCaptionFont
);
1232 hFont
= CreateFontIndirectW(&nclm
.lfCaptionFont
);
1234 if (! hFont
) goto cleanup
;
1236 hOldFont
= SelectObject(MemDC
, hFont
);
1237 if (! hOldFont
) goto cleanup
;
1239 if (uFlags
& DC_INBUTTON
)
1240 OldTextColor
= SetTextColor(MemDC
, GetSysColor(uFlags
& DC_ACTIVE
? COLOR_BTNTEXT
: COLOR_GRAYTEXT
));
1242 OldTextColor
= SetTextColor(MemDC
, GetSysColor(uFlags
& DC_ACTIVE
? COLOR_CAPTIONTEXT
: COLOR_INACTIVECAPTIONTEXT
));
1244 DrawTextW(MemDC
, buffer
, wcslen(buffer
), &r
, DT_VCENTER
| DT_END_ELLIPSIS
);
1246 SetTextColor(MemDC
, OldTextColor
);
1250 if (uFlags
& DC_BUTTONS
)
1252 // Windows XP draws the caption buttons with DC_BUTTONS
1253 // r.left += GetSystemMetrics(SM_CXSIZE) + 1;
1254 // UserDrawCaptionButton( hWnd, hDC, FALSE, DFCS_CAPTIONCLOSE);
1255 // r.right -= GetSystemMetrics(SM_CXSMSIZE) + 1;
1256 // UserDrawCaptionButton( hWnd, hDC, FALSE, DFCS_CAPTIONMIN);
1257 // UserDrawCaptionButton( hWnd, hDC, FALSE, DFCS_CAPTIONMAX);
1261 #ifdef DOUBLE_BUFFER_CAPTION
1262 if (! BitBlt(hDC
, lprc
->left
, lprc
->top
, lprc
->right
- lprc
->left
, lprc
->bottom
- lprc
->top
,
1263 MemDC
, 0, 0, SRCCOPY
)) goto cleanup
;
1271 if (OldBrush
) SelectObject(MemDC
, OldBrush
);
1272 if (hOldFont
) SelectObject(MemDC
, hOldFont
);
1273 if (hFont
) DeleteObject(hFont
);
1274 #ifdef DOUBLE_BUFFER_CAPTION
1275 if (OldBMP
) SelectObject(MemDC
, OldBMP
);
1276 if (MemBMP
) DeleteObject(MemBMP
);
1279 OffsetViewportOrgEx(MemDC
, -lprc
->left
, -lprc
->top
, NULL
);
1325 /***********************************************************************
1328 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
1329 * but without the borders (if any).
1330 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
1332 static void FASTCALL
1333 NcGetInsideRect(HWND Wnd
, RECT
*Rect
)
1338 GetWindowRect(Wnd
, Rect
);
1339 Rect
->right
= Rect
->right
- Rect
->left
;
1341 Rect
->bottom
= Rect
->bottom
- Rect
->top
;
1344 Style
= GetWindowLongW(Wnd
, GWL_STYLE
);
1345 if (0 != (Style
& WS_ICONIC
))
1350 /* Remove frame from rectangle */
1351 ExStyle
= GetWindowLongW(Wnd
, GWL_EXSTYLE
);
1352 if (HAS_THICKFRAME(Style
, ExStyle
))
1354 InflateRect(Rect
, - GetSystemMetrics(SM_CXFRAME
), - GetSystemMetrics(SM_CYFRAME
));
1356 else if (HAS_DLGFRAME(Style
, ExStyle
))
1358 InflateRect(Rect
, - GetSystemMetrics(SM_CXDLGFRAME
), - GetSystemMetrics(SM_CYDLGFRAME
));
1360 else if (HAS_THINFRAME(Style
, ExStyle
))
1362 InflateRect(Rect
, - GetSystemMetrics(SM_CXBORDER
), - GetSystemMetrics(SM_CYBORDER
));
1365 /* We have additional border information if the window
1366 * is a child (but not an MDI child) */
1367 if (0 != (Style
& WS_CHILD
)
1368 && 0 == (ExStyle
& WS_EX_MDICHILD
))
1370 if (0 != (ExStyle
& WS_EX_CLIENTEDGE
))
1372 InflateRect(Rect
, - GetSystemMetrics(SM_CXEDGE
), - GetSystemMetrics(SM_CYEDGE
));
1374 if (0 != (ExStyle
& WS_EX_STATICEDGE
))
1376 InflateRect(Rect
, - GetSystemMetrics(SM_CXBORDER
), - GetSystemMetrics(SM_CYBORDER
));
1381 /***********************************************************************
1385 NcGetSysPopupPos(HWND Wnd
, RECT
*Rect
)
1391 GetWindowRect(Wnd
, Rect
);
1395 NcGetInsideRect(Wnd
, Rect
);
1396 GetWindowRect(Wnd
, &WindowRect
);
1397 OffsetRect(Rect
, WindowRect
.left
, WindowRect
.top
);
1398 if (0 != (GetWindowLongW(Wnd
, GWL_STYLE
) & WS_CHILD
))
1400 ClientToScreen(GetParent(Wnd
), (POINT
*) Rect
);
1402 Rect
->right
= Rect
->left
+ GetSystemMetrics(SM_CYCAPTION
) - 1;
1403 Rect
->bottom
= Rect
->top
+ GetSystemMetrics(SM_CYCAPTION
) - 1;