2 * Non-client area window functions
4 * Copyright 1994 Alexandre Julliard
7 static char Copyright
[] = "Copyright Alexandre Julliard, 1994";
12 #include "sysmetrics.h"
17 /* #define DEBUG_NONCLIENT /* */
18 /* #undef DEBUG_NONCLIENT /* */
22 static HBITMAP hbitmapClose
= 0;
23 static HBITMAP hbitmapMDIClose
= 0;
24 static HBITMAP hbitmapMinimize
= 0;
25 static HBITMAP hbitmapMinimizeD
= 0;
26 static HBITMAP hbitmapMaximize
= 0;
27 static HBITMAP hbitmapMaximizeD
= 0;
28 static HBITMAP hbitmapRestore
= 0;
29 static HBITMAP hbitmapRestoreD
= 0;
31 #define SC_ABOUTWINE (SC_SCREENSAVE+1)
32 extern HINSTANCE hSysRes
;
33 extern BOOL
AboutWine_Proc( HWND hDlg
, WORD msg
, WORD wParam
, LONG lParam
);
35 extern void WINPOS_GetMinMaxInfo( HWND hwnd
, POINT
*maxSize
, POINT
*maxPos
,
36 POINT
*minTrack
, POINT
*maxTrack
); /* winpos.c */
37 extern BOOL
GRAPH_DrawBitmap( HDC hdc
, HBITMAP hbitmap
, int xdest
, int ydest
,
38 int xsrc
, int ysrc
, int width
, int height
,
39 int rop
); /* graphics.c */
40 extern WORD
MENU_GetMenuBarHeight( HWND hwnd
, WORD menubarWidth
,
41 int orgX
, int orgY
); /* menu.c */
42 extern void MENU_TrackMouseMenuBar( HWND hwnd
, POINT pt
); /* menu.c */
43 extern void MENU_TrackKbdMenuBar( HWND hwnd
, WORD wParam
); /* menu.c */
44 extern WORD
MENU_DrawMenuBar( HDC hDC
, LPRECT lprect
,
45 HWND hwnd
, BOOL suppress_draw
); /* menu.c */
48 /* Some useful macros */
49 #define HAS_DLGFRAME(style,exStyle) \
50 (((style) & WS_DLGFRAME) && \
51 (((exStyle) & WS_EX_DLGMODALFRAME) || !((style) & WS_BORDER)))
53 #define HAS_THICKFRAME(style) \
54 (((style) & WS_THICKFRAME) && \
55 !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
57 #define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
59 #define ON_LEFT_BORDER(hit) \
60 (((hit) == HTLEFT) || ((hit) == HTTOPLEFT) || ((hit) == HTBOTTOMLEFT))
61 #define ON_RIGHT_BORDER(hit) \
62 (((hit) == HTRIGHT) || ((hit) == HTTOPRIGHT) || ((hit) == HTBOTTOMRIGHT))
63 #define ON_TOP_BORDER(hit) \
64 (((hit) == HTTOP) || ((hit) == HTTOPLEFT) || ((hit) == HTTOPRIGHT))
65 #define ON_BOTTOM_BORDER(hit) \
66 (((hit) == HTBOTTOM) || ((hit) == HTBOTTOMLEFT) || ((hit) == HTBOTTOMRIGHT))
68 /***********************************************************************
71 * Compute the size of the window rectangle from the size of the
74 static void NC_AdjustRect( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
76 if (HAS_DLGFRAME( style
, exStyle
))
77 InflateRect( rect
, SYSMETRICS_CXDLGFRAME
, SYSMETRICS_CYDLGFRAME
);
80 if (HAS_THICKFRAME(style
))
81 InflateRect( rect
, SYSMETRICS_CXFRAME
, SYSMETRICS_CYFRAME
);
82 if (style
& WS_BORDER
)
83 InflateRect( rect
, SYSMETRICS_CXBORDER
, SYSMETRICS_CYBORDER
);
86 if ((style
& WS_CAPTION
) == WS_CAPTION
)
87 rect
->top
-= SYSMETRICS_CYCAPTION
- SYSMETRICS_CYBORDER
;
88 if (menu
) rect
->top
-= SYSMETRICS_CYMENU
+ SYSMETRICS_CYBORDER
;
90 if (style
& WS_VSCROLL
) rect
->right
+= SYSMETRICS_CXVSCROLL
;
91 if (style
& WS_HSCROLL
) rect
->bottom
+= SYSMETRICS_CYHSCROLL
;
95 /***********************************************************************
96 * AdjustWindowRect (USER.102)
98 void AdjustWindowRect( LPRECT rect
, DWORD style
, BOOL menu
)
100 AdjustWindowRectEx( rect
, style
, menu
, 0 );
104 /***********************************************************************
105 * AdjustWindowRectEx (USER.454)
107 void AdjustWindowRectEx( LPRECT rect
, DWORD style
, BOOL menu
, DWORD exStyle
)
109 /* Correct the window style */
111 if (!(style
& (WS_POPUP
| WS_CHILD
))) /* Overlapped window */
113 if (exStyle
& WS_EX_DLGMODALFRAME
) style
&= ~WS_THICKFRAME
;
115 dprintf_nonclient(stddeb
, "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08x %d %08x\n",
116 rect
->left
, rect
->top
, rect
->right
, rect
->bottom
, style
, menu
, exStyle
);
118 NC_AdjustRect( rect
, style
, menu
, exStyle
);
122 /***********************************************************************
123 * NC_HandleNCCalcSize
125 * Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
127 LONG
NC_HandleNCCalcSize( HWND hwnd
, NCCALCSIZE_PARAMS
*params
)
129 RECT tmpRect
= { 0, 0, 0, 0 };
130 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
132 if (!wndPtr
) return 0;
135 * we don't want to change the size if hwnd is an icon since
136 * there are no window manager handles on an icon
138 if(IsIconic(hwnd
)) return 0;
140 NC_AdjustRect( &tmpRect
, wndPtr
->dwStyle
, FALSE
, wndPtr
->dwExStyle
);
141 params
->rgrc
[0].left
-= tmpRect
.left
;
142 params
->rgrc
[0].top
-= tmpRect
.top
;
143 params
->rgrc
[0].right
-= tmpRect
.right
;
144 params
->rgrc
[0].bottom
-= tmpRect
.bottom
;
146 if (HAS_MENU(wndPtr
))
148 params
->rgrc
[0].top
+= MENU_GetMenuBarHeight( hwnd
,
149 params
->rgrc
[0].right
- params
->rgrc
[0].left
,
150 -tmpRect
.left
, -tmpRect
.top
) + 1;
156 /***********************************************************************
159 * Get the 'inside' rectangle of a window, i.e. the whole window rectangle
160 * but without the borders (if any).
161 * The rectangle is in window coordinates (for drawing with GetWindowDC()).
163 void NC_GetInsideRect( HWND hwnd
, RECT
*rect
)
165 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
167 rect
->top
= rect
->left
= 0;
168 rect
->right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
169 rect
->bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
171 /* Remove frame from rectangle */
172 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
174 InflateRect( rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
175 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
) InflateRect( rect
, -1, 0);
179 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
180 InflateRect( rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
181 if (wndPtr
->dwStyle
& WS_BORDER
)
182 InflateRect( rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
187 /***********************************************************************
190 * Handle a WM_NCHITTEST message. Called from DefWindowProc().
192 LONG
NC_HandleNCHitTest( HWND hwnd
, POINT pt
)
195 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
196 if (!wndPtr
) return HTERROR
;
198 dprintf_nonclient(stddeb
, "NC_HandleNCHitTest: hwnd=%x pt=%d,%d\n",
201 GetWindowRect( hwnd
, &rect
);
202 if (!PtInRect( &rect
, pt
)) return HTNOWHERE
;
205 * if this is a iconic window, we don't care were the hit
206 * occured, only that it did occur, just return HTCAPTION
207 * so the caller knows the icon did get hit
211 return HTCAPTION
; /* change this to something meaningful? */
215 if (HAS_THICKFRAME( wndPtr
->dwStyle
))
217 InflateRect( &rect
, -SYSMETRICS_CXFRAME
, -SYSMETRICS_CYFRAME
);
218 if (wndPtr
->dwStyle
& WS_BORDER
)
219 InflateRect( &rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
220 if (!PtInRect( &rect
, pt
))
222 /* Check top sizing border */
225 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTTOPLEFT
;
226 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTTOPRIGHT
;
229 /* Check bottom sizing border */
230 if (pt
.y
>= rect
.bottom
)
232 if (pt
.x
< rect
.left
+SYSMETRICS_CXSIZE
) return HTBOTTOMLEFT
;
233 if (pt
.x
>= rect
.right
-SYSMETRICS_CXSIZE
) return HTBOTTOMRIGHT
;
236 /* Check left sizing border */
237 if (pt
.x
< rect
.left
)
239 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPLEFT
;
240 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMLEFT
;
243 /* Check right sizing border */
244 if (pt
.x
>= rect
.right
)
246 if (pt
.y
< rect
.top
+SYSMETRICS_CYSIZE
) return HTTOPRIGHT
;
247 if (pt
.y
>= rect
.bottom
-SYSMETRICS_CYSIZE
) return HTBOTTOMRIGHT
;
252 else /* No thick frame */
254 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
255 InflateRect(&rect
, -SYSMETRICS_CXDLGFRAME
, -SYSMETRICS_CYDLGFRAME
);
256 else if (wndPtr
->dwStyle
& WS_BORDER
)
257 InflateRect(&rect
, -SYSMETRICS_CXBORDER
, -SYSMETRICS_CYBORDER
);
258 if (!PtInRect( &rect
, pt
)) return HTBORDER
;
263 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
265 rect
.top
+= SYSMETRICS_CYCAPTION
- 1;
266 if (!PtInRect( &rect
, pt
))
268 /* Check system menu */
269 if (wndPtr
->dwStyle
& WS_SYSMENU
)
270 rect
.left
+= SYSMETRICS_CXSIZE
;
271 if (pt
.x
<= rect
.left
) return HTSYSMENU
;
272 /* Check maximize box */
273 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
274 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
275 if (pt
.x
>= rect
.right
) return HTMAXBUTTON
;
276 /* Check minimize box */
277 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
278 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
279 if (pt
.x
>= rect
.right
) return HTMINBUTTON
;
284 /* Check client area */
286 ScreenToClient( hwnd
, &pt
);
287 GetClientRect( hwnd
, &rect
);
288 if (PtInRect( &rect
, pt
)) return HTCLIENT
;
290 /* Check vertical scroll bar */
292 if (wndPtr
->dwStyle
& WS_VSCROLL
)
294 rect
.right
+= SYSMETRICS_CXVSCROLL
;
295 if (PtInRect( &rect
, pt
)) return HTVSCROLL
;
298 /* Check horizontal scroll bar */
300 if (wndPtr
->dwStyle
& WS_HSCROLL
)
302 rect
.bottom
+= SYSMETRICS_CYHSCROLL
;
303 if (PtInRect( &rect
, pt
))
306 if ((wndPtr
->dwStyle
& WS_VSCROLL
) &&
307 (pt
.x
>= rect
.right
- SYSMETRICS_CXVSCROLL
))
315 if (HAS_MENU(wndPtr
))
317 if ((pt
.y
< 0) && (pt
.x
>= 0) && (pt
.x
< rect
.right
))
321 /* Should never get here */
326 /***********************************************************************
329 void NC_DrawSysButton( HWND hwnd
, HDC hdc
, BOOL down
)
332 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
333 NC_GetInsideRect( hwnd
, &rect
);
334 GRAPH_DrawBitmap( hdc
, (wndPtr
->dwStyle
& WS_CHILD
) ?
335 hbitmapMDIClose
: hbitmapClose
,
337 1, 1, SYSMETRICS_CXSIZE
, SYSMETRICS_CYSIZE
,
338 down
? NOTSRCCOPY
: SRCCOPY
);
342 /***********************************************************************
345 static void NC_DrawMaxButton( HWND hwnd
, HDC hdc
, BOOL down
)
348 NC_GetInsideRect( hwnd
, &rect
);
349 GRAPH_DrawBitmap( hdc
, (IsZoomed(hwnd
) ?
350 (down
? hbitmapRestoreD
: hbitmapRestore
) :
351 (down
? hbitmapMaximizeD
: hbitmapMaximize
)),
352 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
- 1,
353 0, 0, SYSMETRICS_CXSIZE
+2, SYSMETRICS_CYSIZE
+2, SRCCOPY
);
357 /***********************************************************************
360 static void NC_DrawMinButton( HWND hwnd
, HDC hdc
, BOOL down
)
363 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
364 NC_GetInsideRect( hwnd
, &rect
);
365 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
) rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
366 GRAPH_DrawBitmap( hdc
, (down
? hbitmapMinimizeD
: hbitmapMinimize
),
367 rect
.right
- SYSMETRICS_CXSIZE
- 1, rect
.top
- 1,
368 0, 0, SYSMETRICS_CXSIZE
+2, SYSMETRICS_CYSIZE
+2, SRCCOPY
);
372 /***********************************************************************
375 * Draw a window frame inside the given rectangle, and update the rectangle.
376 * The correct pen for the frame must be selected in the DC.
378 static void NC_DrawFrame( HDC hdc
, RECT
*rect
, BOOL dlgFrame
, BOOL active
)
380 short width
, height
, tmp
;
384 width
= SYSMETRICS_CXDLGFRAME
- 1;
385 height
= SYSMETRICS_CYDLGFRAME
- 1;
386 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveCaption
:
387 sysColorObjects
.hbrushInactiveCaption
);
391 width
= SYSMETRICS_CXFRAME
- 1;
392 height
= SYSMETRICS_CYFRAME
- 1;
393 SelectObject( hdc
, active
? sysColorObjects
.hbrushActiveBorder
:
394 sysColorObjects
.hbrushInactiveBorder
);
398 PatBlt( hdc
, rect
->left
, rect
->top
,
399 rect
->right
- rect
->left
, height
, PATCOPY
);
400 PatBlt( hdc
, rect
->left
, rect
->top
,
401 width
, rect
->bottom
- rect
->top
, PATCOPY
);
402 PatBlt( hdc
, rect
->left
, rect
->bottom
,
403 rect
->right
- rect
->left
, -height
, PATCOPY
);
404 PatBlt( hdc
, rect
->right
, rect
->top
,
405 -width
, rect
->bottom
- rect
->top
, PATCOPY
);
409 InflateRect( rect
, -width
, -height
);
413 /* Draw inner rectangle */
414 MoveTo( hdc
, rect
->left
+width
, rect
->top
+height
);
415 LineTo( hdc
, rect
->right
-width
-1, rect
->top
+height
);
416 LineTo( hdc
, rect
->right
-width
-1, rect
->bottom
-height
-1 );
417 LineTo( hdc
, rect
->left
+width
, rect
->bottom
-height
-1 );
418 LineTo( hdc
, rect
->left
+width
, rect
->top
+height
);
420 /* Draw the decorations */
421 tmp
= rect
->top
+ SYSMETRICS_CYFRAME
+ SYSMETRICS_CYSIZE
;
422 MoveTo( hdc
, rect
->left
, tmp
);
423 LineTo( hdc
, rect
->left
+width
, tmp
);
424 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
425 LineTo( hdc
, rect
->right
-1, tmp
);
427 tmp
= rect
->bottom
- 1 - SYSMETRICS_CYFRAME
- SYSMETRICS_CYSIZE
;
428 MoveTo( hdc
, rect
->left
, tmp
);
429 LineTo( hdc
, rect
->left
+width
, tmp
);
430 MoveTo( hdc
, rect
->right
-width
-1, tmp
);
431 LineTo( hdc
, rect
->right
-1, tmp
);
433 tmp
= rect
->left
+ SYSMETRICS_CXFRAME
+ SYSMETRICS_CXSIZE
;
434 MoveTo( hdc
, tmp
, rect
->top
);
435 LineTo( hdc
, tmp
, rect
->top
+height
);
436 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
437 LineTo( hdc
, tmp
, rect
->bottom
-1 );
439 tmp
= rect
->right
- 1 - SYSMETRICS_CXFRAME
- SYSMETRICS_CYSIZE
;
440 MoveTo( hdc
, tmp
, rect
->top
);
441 LineTo( hdc
, tmp
, rect
->top
+height
);
442 MoveTo( hdc
, tmp
, rect
->bottom
-height
-1 );
443 LineTo( hdc
, tmp
, rect
->bottom
-1 );
445 InflateRect( rect
, -width
-1, -height
-1 );
449 /***********************************************************************
452 * Draw the frame used when moving or resizing window.
454 static void NC_DrawMovingFrame( HDC hdc
, RECT
*rect
, BOOL thickframe
)
458 SelectObject( hdc
, GetStockObject( GRAY_BRUSH
) );
459 PatBlt( hdc
, rect
->left
, rect
->top
,
460 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
461 SYSMETRICS_CYFRAME
, PATINVERT
);
462 PatBlt( hdc
, rect
->left
, rect
->top
+ SYSMETRICS_CYFRAME
,
464 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
465 PatBlt( hdc
, rect
->left
+ SYSMETRICS_CXFRAME
, rect
->bottom
,
466 rect
->right
- rect
->left
- SYSMETRICS_CXFRAME
,
467 -SYSMETRICS_CYFRAME
, PATINVERT
);
468 PatBlt( hdc
, rect
->right
, rect
->top
, -SYSMETRICS_CXFRAME
,
469 rect
->bottom
- rect
->top
- SYSMETRICS_CYFRAME
, PATINVERT
);
471 else DrawFocusRect( hdc
, rect
);
475 /***********************************************************************
478 * Draw the window caption.
479 * The correct pen for the window frame must be selected in the DC.
481 static void NC_DrawCaption( HDC hdc
, RECT
*rect
, HWND hwnd
,
482 DWORD style
, BOOL active
)
485 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
490 if (!(hbitmapClose
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_CLOSE
) )))
492 if (!(hbitmapMDIClose
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_OLD_CLOSE
) )))
494 hbitmapMinimize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCE
) );
495 hbitmapMinimizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_REDUCED
) );
496 hbitmapMaximize
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOM
) );
497 hbitmapMaximizeD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_ZOOMD
) );
498 hbitmapRestore
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORE
) );
499 hbitmapRestoreD
= LoadBitmap( 0, MAKEINTRESOURCE(OBM_RESTORED
) );
502 if (wndPtr
->dwExStyle
& WS_EX_DLGMODALFRAME
)
504 HBRUSH hbrushOld
= SelectObject( hdc
, sysColorObjects
.hbrushWindow
);
505 PatBlt( hdc
, r
.left
, r
.top
, 1, r
.bottom
-r
.top
+1,PATCOPY
);
506 PatBlt( hdc
, r
.right
-1, r
.top
, 1, r
.bottom
-r
.top
+1, PATCOPY
);
507 PatBlt( hdc
, r
.left
, r
.top
-1, r
.right
-r
.left
, 1, PATCOPY
);
510 SelectObject( hdc
, hbrushOld
);
513 MoveTo( hdc
, r
.left
, r
.bottom
);
514 LineTo( hdc
, r
.right
-1, r
.bottom
);
516 if (style
& WS_SYSMENU
)
518 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
519 r
.left
+= SYSMETRICS_CXSIZE
+ 1;
520 MoveTo( hdc
, r
.left
- 1, r
.top
);
521 LineTo( hdc
, r
.left
- 1, r
.bottom
);
523 if (style
& WS_MAXIMIZEBOX
)
525 NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
526 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
528 if (style
& WS_MINIMIZEBOX
)
530 NC_DrawMinButton( hwnd
, hdc
, FALSE
);
531 r
.right
-= SYSMETRICS_CXSIZE
+ 1;
534 FillRect( hdc
, &r
, active
? sysColorObjects
.hbrushActiveCaption
:
535 sysColorObjects
.hbrushInactiveCaption
);
537 if (GetWindowText( hwnd
, buffer
, 256 ))
539 if (active
) SetTextColor( hdc
, GetSysColor( COLOR_CAPTIONTEXT
) );
540 else SetTextColor( hdc
, GetSysColor( COLOR_INACTIVECAPTIONTEXT
) );
541 SetBkMode( hdc
, TRANSPARENT
);
542 DrawText( hdc
, buffer
, -1, &r
, DT_SINGLELINE
| DT_CENTER
| DT_VCENTER
);
547 /***********************************************************************
550 * Paint the non-client area.
551 * 'hrgn' is the update rgn to use (in client coords) or 1 if no update rgn.
553 void NC_DoNCPaint( HWND hwnd
, HRGN hrgn
, BOOL active
, BOOL suppress_menupaint
)
558 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
560 dprintf_nonclient(stddeb
, "NC_DoNCPaint: %d %d\n", hwnd
, hrgn
);
561 if (!wndPtr
|| !hrgn
) return;
562 if ((!(wndPtr
->dwStyle
& (WS_BORDER
| WS_DLGFRAME
| WS_THICKFRAME
))) ||
563 (!(wndPtr
->dwStyle
& WS_VISIBLE
)))
564 return; /* Nothing to do! */
566 if (hrgn
== 1) hdc
= GetDCEx( hwnd
, 0, DCX_USESTYLE
| DCX_WINDOW
);
569 /* Make region relative to window area */
570 int xoffset
= wndPtr
->rectWindow
.left
- wndPtr
->rectClient
.left
;
571 int yoffset
= wndPtr
->rectWindow
.top
- wndPtr
->rectClient
.top
;
572 OffsetRgn( hrgn
, -xoffset
, -yoffset
);
573 hdc
= GetDCEx( hwnd
, hrgn
, DCX_USESTYLE
|DCX_WINDOW
|DCX_INTERSECTRGN
);
574 OffsetRgn( hrgn
, xoffset
, yoffset
); /* Restore region */
580 * If this is an icon, we don't want to do any more nonclient painting
581 * of the window manager.
582 * If there is a class icon to draw, draw it
586 HICON hIcon
= WIN_CLASS_INFO(wndPtr
).hIcon
;
589 SendMessage(hwnd
, WM_ICONERASEBKGND
, hdc
, 0);
590 Rectangle(hdc
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
,
591 wndPtr
->rectWindow
.right
, wndPtr
->rectWindow
.bottom
);
592 DrawIcon(hdc
, 0, 0, hIcon
);
594 ReleaseDC(hwnd
, hdc
);
598 if (ExcludeVisRect( hdc
, wndPtr
->rectClient
.left
-wndPtr
->rectWindow
.left
,
599 wndPtr
->rectClient
.top
-wndPtr
->rectWindow
.top
,
600 wndPtr
->rectClient
.right
-wndPtr
->rectWindow
.left
,
601 wndPtr
->rectClient
.bottom
-wndPtr
->rectWindow
.top
)
604 ReleaseDC( hwnd
, hdc
);
608 rect
.top
= rect
.left
= 0;
609 rect
.right
= wndPtr
->rectWindow
.right
- wndPtr
->rectWindow
.left
;
610 rect
.bottom
= wndPtr
->rectWindow
.bottom
- wndPtr
->rectWindow
.top
;
612 SelectObject( hdc
, sysColorObjects
.hpenWindowFrame
);
614 if ((wndPtr
->dwStyle
& WS_BORDER
) || (wndPtr
->dwStyle
& WS_DLGFRAME
))
617 LineTo( hdc
, rect
.right
-1, 0 );
618 LineTo( hdc
, rect
.right
-1, rect
.bottom
-1 );
619 LineTo( hdc
, 0, rect
.bottom
-1 );
621 InflateRect( &rect
, -1, -1 );
624 if (HAS_DLGFRAME( wndPtr
->dwStyle
, wndPtr
->dwExStyle
))
625 NC_DrawFrame( hdc
, &rect
, TRUE
, active
);
626 else if (wndPtr
->dwStyle
& WS_THICKFRAME
)
627 NC_DrawFrame(hdc
, &rect
, FALSE
, active
);
629 if ((wndPtr
->dwStyle
& WS_CAPTION
) == WS_CAPTION
)
632 r
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
633 rect
.top
+= SYSMETRICS_CYSIZE
+ SYSMETRICS_CYBORDER
;
634 NC_DrawCaption( hdc
, &r
, hwnd
, wndPtr
->dwStyle
, active
);
637 if (HAS_MENU(wndPtr
))
640 r
.bottom
= rect
.top
+ SYSMETRICS_CYMENU
; /* default height */
641 rect
.top
+= MENU_DrawMenuBar( hdc
, &r
, hwnd
, suppress_menupaint
);
644 if (wndPtr
->dwStyle
& (WS_VSCROLL
| WS_HSCROLL
)) {
645 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->VScroll
!= NULL
) &&
646 (wndPtr
->scroll_flags
& 0x0001)) {
647 int bottom
= rect
.bottom
;
648 if ((wndPtr
->dwStyle
& WS_HSCROLL
) && (wndPtr
->scroll_flags
& 0x0001))
649 bottom
-= SYSMETRICS_CYHSCROLL
;
650 SetRect(&rect2
, rect
.right
- SYSMETRICS_CXVSCROLL
,
651 rect
.top
, rect
.right
, bottom
);
652 StdDrawScrollBar(hwnd
, hdc
, SB_VERT
, &rect2
, (LPHEADSCROLL
)wndPtr
->VScroll
);
654 if ((wndPtr
->dwStyle
& WS_HSCROLL
) && wndPtr
->HScroll
!= NULL
&&
655 (wndPtr
->scroll_flags
& 0x0002)) {
656 int right
= rect
.right
;
657 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->scroll_flags
& 0x0001))
658 right
-= SYSMETRICS_CYVSCROLL
;
659 SetRect(&rect2
, rect
.left
, rect
.bottom
- SYSMETRICS_CYHSCROLL
,
661 StdDrawScrollBar(hwnd
, hdc
, SB_HORZ
, &rect2
, (LPHEADSCROLL
)wndPtr
->HScroll
);
664 if ((wndPtr
->dwStyle
& WS_VSCROLL
) && (wndPtr
->dwStyle
& WS_HSCROLL
) &&
665 (wndPtr
->scroll_flags
& 0x0003) == 0x0003) {
667 r
.left
= r
.right
- SYSMETRICS_CXVSCROLL
;
668 r
.top
= r
.bottom
- SYSMETRICS_CYHSCROLL
;
669 FillRect( hdc
, &r
, sysColorObjects
.hbrushScrollbar
);
673 ReleaseDC( hwnd
, hdc
);
678 /***********************************************************************
681 * Handle a WM_NCPAINT message. Called from DefWindowProc().
683 LONG
NC_HandleNCPaint( HWND hwnd
, HRGN hrgn
)
685 NC_DoNCPaint( hwnd
, hrgn
, hwnd
== GetActiveWindow(), FALSE
);
690 /***********************************************************************
691 * NC_HandleNCActivate
693 * Handle a WM_NCACTIVATE message. Called from DefWindowProc().
695 LONG
NC_HandleNCActivate( HWND hwnd
, WORD wParam
)
697 NC_DoNCPaint( hwnd
, (HRGN
)1, wParam
, FALSE
);
702 /***********************************************************************
705 * Handle a WM_SETCURSOR message. Called from DefWindowProc().
707 LONG
NC_HandleSetCursor( HWND hwnd
, WORD wParam
, LONG lParam
)
709 if (hwnd
!= wParam
) return 0; /* Don't set the cursor for child windows */
711 switch(LOWORD(lParam
))
715 WORD msg
= HIWORD( lParam
);
716 if ((msg
== WM_LBUTTONDOWN
) || (msg
== WM_MBUTTONDOWN
) ||
717 (msg
== WM_RBUTTONDOWN
))
726 if (!(wndPtr
= WIN_FindWndPtr( hwnd
))) break;
727 if (!(classPtr
= CLASS_FindClassPtr( wndPtr
->hClass
))) break;
728 if (classPtr
->wc
.hCursor
)
730 SetCursor( classPtr
->wc
.hCursor
);
738 return SetCursor( LoadCursor( 0, IDC_SIZEWE
) );
742 return SetCursor( LoadCursor( 0, IDC_SIZENS
) );
746 return SetCursor( LoadCursor( 0, IDC_SIZENWSE
) );
750 return SetCursor( LoadCursor( 0, IDC_SIZENESW
) );
753 /* Default cursor: arrow */
754 return SetCursor( LoadCursor( 0, IDC_ARROW
) );
758 /***********************************************************************
761 * Initialisation of a move or resize, when initiatied from a menu choice.
762 * Return hit test code for caption or sizing border.
764 static LONG
NC_StartSizeMove( HWND hwnd
, WORD wParam
, POINT
*capturePoint
)
769 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
771 if ((wParam
& 0xfff0) == SC_MOVE
)
773 /* Move pointer at the center of the caption */
775 NC_GetInsideRect( hwnd
, &rect
);
776 if (wndPtr
->dwStyle
& WS_SYSMENU
)
777 rect
.left
+= SYSMETRICS_CXSIZE
+ 1;
778 if (wndPtr
->dwStyle
& WS_MINIMIZEBOX
)
779 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
780 if (wndPtr
->dwStyle
& WS_MAXIMIZEBOX
)
781 rect
.right
-= SYSMETRICS_CXSIZE
+ 1;
782 pt
.x
= wndPtr
->rectWindow
.left
+ (rect
.right
- rect
.left
) / 2;
783 pt
.y
= wndPtr
->rectWindow
.top
+ rect
.top
+ SYSMETRICS_CYSIZE
/2;
784 if (wndPtr
->dwStyle
& WS_CHILD
)
785 ClientToScreen( wndPtr
->hwndParent
, &pt
);
793 MSG_GetHardwareMessage( &msg
);
797 hittest
= NC_HandleNCHitTest( hwnd
, msg
.pt
);
799 if ((hittest
< HTLEFT
) || (hittest
> HTBOTTOMRIGHT
))
811 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
812 pt
.y
= wndPtr
->rectWindow
.top
+ SYSMETRICS_CYFRAME
/ 2;
816 pt
.x
=(wndPtr
->rectWindow
.left
+wndPtr
->rectWindow
.right
)/2;
817 pt
.y
= wndPtr
->rectWindow
.bottom
- SYSMETRICS_CYFRAME
/ 2;
821 pt
.x
= wndPtr
->rectWindow
.left
+ SYSMETRICS_CXFRAME
/ 2;
822 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
826 pt
.x
= wndPtr
->rectWindow
.right
- SYSMETRICS_CXFRAME
/ 2;
827 pt
.y
=(wndPtr
->rectWindow
.top
+wndPtr
->rectWindow
.bottom
)/2;
830 case VK_ESCAPE
: return 0;
836 SetCursorPos( capturePoint
->x
, capturePoint
->y
);
837 NC_HandleSetCursor( hwnd
, hwnd
, MAKELONG( hittest
, WM_MOUSEMOVE
));
842 /***********************************************************************
845 * Perform SC_MOVE and SC_SIZE commands.
847 static void NC_DoSizeMove( HWND hwnd
, WORD wParam
, POINT pt
)
851 RECT sizingRect
, mouseRect
;
854 POINT minTrack
, maxTrack
, capturePoint
= pt
;
855 WND
* wndPtr
= WIN_FindWndPtr( hwnd
);
857 if (IsZoomed(hwnd
) || !IsWindowVisible(hwnd
)) return;
858 hittest
= wParam
& 0x0f;
859 thickframe
= HAS_THICKFRAME( wndPtr
->dwStyle
);
861 if ((wParam
& 0xfff0) == SC_MOVE
)
863 if (!(wndPtr
->dwStyle
& WS_CAPTION
)) return;
864 if (!hittest
) hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
865 if (!hittest
) return;
869 if (!thickframe
) return;
870 if (hittest
) hittest
+= HTLEFT
-1;
874 hittest
= NC_StartSizeMove( hwnd
, wParam
, &capturePoint
);
883 /* Get min/max info */
885 WINPOS_GetMinMaxInfo( hwnd
, NULL
, NULL
, &minTrack
, &maxTrack
);
886 sizingRect
= wndPtr
->rectWindow
;
887 if (wndPtr
->dwStyle
& WS_CHILD
)
888 GetClientRect( wndPtr
->hwndParent
, &mouseRect
);
889 else SetRect( &mouseRect
, 0, 0, SYSMETRICS_CXSCREEN
, SYSMETRICS_CYSCREEN
);
890 if (ON_LEFT_BORDER(hittest
))
892 mouseRect
.left
= max( mouseRect
.left
, sizingRect
.right
-maxTrack
.x
);
893 mouseRect
.right
= min( mouseRect
.right
, sizingRect
.right
-minTrack
.x
);
895 else if (ON_RIGHT_BORDER(hittest
))
897 mouseRect
.left
= max( mouseRect
.left
, sizingRect
.left
+minTrack
.x
);
898 mouseRect
.right
= min( mouseRect
.right
, sizingRect
.left
+maxTrack
.x
);
900 if (ON_TOP_BORDER(hittest
))
902 mouseRect
.top
= max( mouseRect
.top
, sizingRect
.bottom
-maxTrack
.y
);
903 mouseRect
.bottom
= min( mouseRect
.bottom
,sizingRect
.bottom
-minTrack
.y
);
905 else if (ON_BOTTOM_BORDER(hittest
))
907 mouseRect
.top
= max( mouseRect
.top
, sizingRect
.top
+minTrack
.y
);
908 mouseRect
.bottom
= min( mouseRect
.bottom
, sizingRect
.top
+maxTrack
.y
);
910 SendMessage( hwnd
, WM_ENTERSIZEMOVE
, 0, 0 );
912 if (GetCapture() != hwnd
) SetCapture( hwnd
);
914 if (wndPtr
->dwStyle
& WS_CHILD
) hdc
= GetDC( wndPtr
->hwndParent
);
916 { /* Grab the server only when moving top-level windows without desktop */
918 if (rootWindow
== DefaultRootWindow(display
)) XGrabServer( display
);
920 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
926 MSG_GetHardwareMessage( &msg
);
928 /* Exit on button-up, Return, or Esc */
929 if ((msg
.message
== WM_LBUTTONUP
) ||
930 ((msg
.message
== WM_KEYDOWN
) &&
931 ((msg
.wParam
== VK_RETURN
) || (msg
.wParam
== VK_ESCAPE
)))) break;
933 if ((msg
.message
!= WM_KEYDOWN
) && (msg
.message
!= WM_MOUSEMOVE
))
934 continue; /* We are not interested in other messages */
937 if (wndPtr
->dwStyle
& WS_CHILD
)
938 ScreenToClient( wndPtr
->hwndParent
, &pt
);
941 if (msg
.message
== WM_KEYDOWN
) switch(msg
.wParam
)
943 case VK_UP
: pt
.y
-= 8; break;
944 case VK_DOWN
: pt
.y
+= 8; break;
945 case VK_LEFT
: pt
.x
-= 8; break;
946 case VK_RIGHT
: pt
.x
+= 8; break;
949 pt
.x
= max( pt
.x
, mouseRect
.left
);
950 pt
.x
= min( pt
.x
, mouseRect
.right
);
951 pt
.y
= max( pt
.y
, mouseRect
.top
);
952 pt
.y
= min( pt
.y
, mouseRect
.bottom
);
954 dx
= pt
.x
- capturePoint
.x
;
955 dy
= pt
.y
- capturePoint
.y
;
959 if (msg
.message
== WM_KEYDOWN
) SetCursorPos( pt
.x
, pt
.y
);
962 RECT newRect
= sizingRect
;
964 if (hittest
== HTCAPTION
) OffsetRect( &newRect
, dx
, dy
);
965 if (ON_LEFT_BORDER(hittest
)) newRect
.left
+= dx
;
966 else if (ON_RIGHT_BORDER(hittest
)) newRect
.right
+= dx
;
967 if (ON_TOP_BORDER(hittest
)) newRect
.top
+= dy
;
968 else if (ON_BOTTOM_BORDER(hittest
)) newRect
.bottom
+= dy
;
969 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
970 NC_DrawMovingFrame( hdc
, &newRect
, thickframe
);
972 sizingRect
= newRect
;
977 NC_DrawMovingFrame( hdc
, &sizingRect
, thickframe
);
979 if (wndPtr
->dwStyle
& WS_CHILD
) ReleaseDC( wndPtr
->hwndParent
, hdc
);
983 if (rootWindow
== DefaultRootWindow(display
)) XUngrabServer( display
);
985 SendMessage( hwnd
, WM_EXITSIZEMOVE
, 0, 0 );
987 /* If Esc key, don't move the window */
988 if ((msg
.message
== WM_KEYDOWN
) && (msg
.wParam
== VK_ESCAPE
)) return;
990 if (hittest
!= HTCAPTION
)
991 SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
,
992 sizingRect
.right
- sizingRect
.left
,
993 sizingRect
.bottom
- sizingRect
.top
,
994 SWP_NOACTIVATE
| SWP_NOZORDER
);
995 else SetWindowPos( hwnd
, 0, sizingRect
.left
, sizingRect
.top
, 0, 0,
996 SWP_NOACTIVATE
| SWP_NOSIZE
| SWP_NOZORDER
);
1000 /***********************************************************************
1003 * Track a mouse button press on the minimize or maximize box.
1005 static void NC_TrackMinMaxBox( HWND hwnd
, WORD wParam
)
1008 HDC hdc
= GetWindowDC( hwnd
);
1009 BOOL pressed
= TRUE
;
1012 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, TRUE
);
1013 else NC_DrawMaxButton( hwnd
, hdc
, TRUE
);
1017 BOOL oldstate
= pressed
;
1018 MSG_GetHardwareMessage( &msg
);
1020 pressed
= (NC_HandleNCHitTest( hwnd
, msg
.pt
) == wParam
);
1021 if (pressed
!= oldstate
)
1023 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, pressed
);
1024 else NC_DrawMaxButton( hwnd
, hdc
, pressed
);
1026 } while (msg
.message
!= WM_LBUTTONUP
);
1028 if (wParam
== HTMINBUTTON
) NC_DrawMinButton( hwnd
, hdc
, FALSE
);
1029 else NC_DrawMaxButton( hwnd
, hdc
, FALSE
);
1032 ReleaseDC( hwnd
, hdc
);
1033 if (!pressed
) return;
1035 if (wParam
== HTMINBUTTON
)
1036 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MINIMIZE
, *(LONG
*)&msg
.pt
);
1038 SendMessage( hwnd
, WM_SYSCOMMAND
,
1039 IsZoomed(hwnd
) ? SC_RESTORE
: SC_MAXIMIZE
, *(LONG
*)&msg
.pt
);
1043 /***********************************************************************
1046 * Track a mouse button press on the horizontal or vertical scroll-bar.
1048 static void NC_TrackScrollBar( HWND hwnd
, WORD wParam
, POINT pt
)
1052 if ((wParam
& 0xfff0) == SC_HSCROLL
)
1054 if ((wParam
& 0x0f) != HTHSCROLL
) return;
1055 scrollbar
= SB_HORZ
;
1057 else /* SC_VSCROLL */
1059 if ((wParam
& 0x0f) != HTVSCROLL
) return;
1060 scrollbar
= SB_VERT
;
1063 ScreenToClient( hwnd
, &pt
);
1064 ScrollBarButtonDown( hwnd
, scrollbar
, pt
.x
, pt
.y
);
1069 MSG_GetHardwareMessage( &msg
);
1070 ScreenToClient( hwnd
, &msg
.pt
);
1074 ScrollBarButtonUp( hwnd
, scrollbar
, msg
.pt
.x
, msg
.pt
.y
);
1077 ScrollBarMouseMove(hwnd
, scrollbar
, msg
.wParam
, msg
.pt
.x
,msg
.pt
.y
);
1080 } while (msg
.message
!= WM_LBUTTONUP
);
1084 /***********************************************************************
1087 * Track a mouse button press on the system menu.
1089 static void NC_TrackSysMenu( HWND hwnd
, HDC hdc
, POINT pt
)
1092 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1094 if (!(wndPtr
->dwStyle
& WS_SYSMENU
)) return;
1095 /* If window has a menu, track the menu bar normally */
1096 if (HAS_MENU(wndPtr
)) MENU_TrackMouseMenuBar( hwnd
, pt
);
1099 /* Otherwise track the system menu like a normal popup menu */
1100 NC_GetInsideRect( hwnd
, &rect
);
1101 OffsetRect( &rect
, wndPtr
->rectWindow
.left
, wndPtr
->rectWindow
.top
);
1102 if (wndPtr
->dwStyle
& WS_CHILD
)
1103 ClientToScreen( wndPtr
->hwndParent
, (POINT
*)&rect
);
1104 rect
.right
= rect
.left
+ SYSMETRICS_CXSIZE
;
1105 rect
.bottom
= rect
.top
+ SYSMETRICS_CYSIZE
;
1106 NC_DrawSysButton( hwnd
, hdc
, TRUE
);
1107 TrackPopupMenu( wndPtr
->hSysMenu
, TPM_LEFTALIGN
| TPM_LEFTBUTTON
,
1108 rect
.left
, rect
.bottom
, 0, hwnd
, &rect
);
1109 NC_DrawSysButton( hwnd
, hdc
, FALSE
);
1114 /***********************************************************************
1115 * NC_HandleNCLButtonDown
1117 * Handle a WM_NCLBUTTONDOWN message. Called from DefWindowProc().
1119 LONG
NC_HandleNCLButtonDown( HWND hwnd
, WORD wParam
, LONG lParam
)
1121 HDC hdc
= GetWindowDC( hwnd
);
1123 switch(wParam
) /* Hit test */
1126 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOVE
+ HTCAPTION
, lParam
);
1130 NC_TrackSysMenu( hwnd
, hdc
, MAKEPOINT(lParam
) );
1134 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MOUSEMENU
, lParam
);
1138 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_HSCROLL
+ HTHSCROLL
, lParam
);
1142 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_VSCROLL
+ HTVSCROLL
, lParam
);
1147 NC_TrackMinMaxBox( hwnd
, wParam
);
1158 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_SIZE
+ wParam
- HTLEFT
+1, lParam
);
1165 ReleaseDC( hwnd
, hdc
);
1170 /***********************************************************************
1171 * NC_HandleNCLButtonDblClk
1173 * Handle a WM_NCLBUTTONDBLCLK message. Called from DefWindowProc().
1175 LONG
NC_HandleNCLButtonDblClk( HWND hwnd
, WORD wParam
, LONG lParam
)
1178 * if this is an icon, send a restore since we are handling
1183 SendMessage(hwnd
, WM_SYSCOMMAND
, SC_RESTORE
, lParam
);
1187 switch(wParam
) /* Hit test */
1190 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_MAXIMIZE
, lParam
);
1194 SendMessage( hwnd
, WM_SYSCOMMAND
, SC_CLOSE
, lParam
);
1201 /***********************************************************************
1202 * NC_HandleSysCommand
1204 * Handle a WM_SYSCOMMAND message. Called from DefWindowProc().
1206 LONG
NC_HandleSysCommand( HWND hwnd
, WORD wParam
, POINT pt
)
1208 WND
*wndPtr
= WIN_FindWndPtr( hwnd
);
1210 dprintf_nonclient(stddeb
, "Handling WM_SYSCOMMAND %x %d,%d\n",
1211 wParam
, pt
.x
, pt
.y
);
1213 if (wndPtr
->dwStyle
& WS_CHILD
) ScreenToClient( wndPtr
->hwndParent
, &pt
);
1215 switch (wParam
& 0xfff0)
1219 NC_DoSizeMove( hwnd
, wParam
, pt
);
1223 ShowWindow( hwnd
, SW_MINIMIZE
);
1227 ShowWindow( hwnd
, SW_MAXIMIZE
);
1231 ShowWindow( hwnd
, SW_RESTORE
);
1239 return SendMessage( hwnd
, WM_CLOSE
, 0, 0 );
1243 if (wndPtr
->dwStyle
& WS_CHILD
) ClientToScreen(wndPtr
->hwndParent
, &pt
);
1244 NC_TrackScrollBar( hwnd
, wParam
, pt
);
1248 MENU_TrackMouseMenuBar( hwnd
, pt
);
1252 MENU_TrackKbdMenuBar( hwnd
, wParam
);
1259 /* WinExec( "taskman.exe", SW_SHOWNORMAL ); */
1266 if (wParam
== SC_ABOUTWINE
)
1267 DialogBox( hSysRes
, MAKEINTRESOURCE(2),
1268 hwnd
, (FARPROC
)AboutWine_Proc
);