2 * Copyright 2006 Saveliy Tretiakov
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 /* This testapp demonstrates WS_SYSMENU + WS_EX_DLGMODALFRAME
20 * behavior and shows that DrawCaption does care
21 * about WS_EX_DLGMODALFRAME and WS_EX_TOOLWINDOW
28 WCHAR WndClass
[] = L
"sysicon_class";
30 LRESULT CALLBACK
WndProc(HWND hWnd
,
44 GetClientRect(hWnd
, &Rect
);
51 hDc
= BeginPaint(hWnd
, &Ps
);
52 SetBkMode( hDc
, TRANSPARENT
);
54 DrawCaption(hWnd
, hDc
, &Rect
, DC_GRADIENT
| DC_ACTIVE
| DC_TEXT
| DC_ICON
);
66 return DefWindowProc(hWnd
, msg
, wParam
, lParam
);
69 int APIENTRY
wWinMain(HINSTANCE hInst
,
70 HINSTANCE hPrevInstance
,
74 HWND hWnd1
, hWnd2
, hWnd3
;
79 memset(&wcx
, 0, sizeof(wcx
));
80 wcx
.cbSize
= sizeof(wcx
);
81 wcx
.lpfnWndProc
= (WNDPROC
) WndProc
;
82 wcx
.hInstance
= hInst
;
83 wcx
.hbrBackground
= (HBRUSH
)COLOR_WINDOW
;
84 wcx
.lpszClassName
= WndClass
;
86 if(!(result
= RegisterClassEx(&wcx
)))
91 /* WS_EX_DLGMODALFRAME */
92 hWnd1
= CreateWindowEx(WS_EX_DLGMODALFRAME
,
94 L
"WS_SYSMENU | WS_EX_DLGMODALFRAME",
95 WS_CAPTION
| WS_SYSMENU
,
110 ShowWindow(hWnd1
, SW_SHOW
);
113 hWnd2
= CreateWindowEx(WS_EX_TOOLWINDOW
,
115 L
"WS_SYSMENU | WS_EX_TOOLWINDOW",
116 WS_CAPTION
| WS_SYSMENU
,
131 ShowWindow(hWnd2
, SW_SHOW
);
134 hWnd3
= CreateWindowEx(0,
137 WS_CAPTION
| WS_SYSMENU
,
152 ShowWindow(hWnd3
, SW_SHOW
);
155 while(GetMessage(&msg
, NULL
, 0, 0 ))
157 TranslateMessage(&msg
);
158 DispatchMessage(&msg
);
161 UnregisterClass(WndClass
, hInst
);