This repository was archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 601
Expand file tree
/
Copy pathcef_main_window.cpp
More file actions
610 lines (522 loc) · 19.6 KB
/
cef_main_window.cpp
File metadata and controls
610 lines (522 loc) · 19.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
/*
* Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "cefclient.h"
#include "cef_main_window.h"
#include "cef_registry.h"
#include "client_handler.h"
#include "resource.h"
#include "native_menu_model.h"
#include "config.h"
#include <sstream>
// external
extern HINSTANCE hInst;
extern CefRefPtr<ClientHandler> g_handler;
// portable build file structure
typedef struct {
char szSignature[18]; // MAKEPORTABLE_BRACKETS_SIGNATURE_STRING
unsigned short uVersion; // current file version
RECT rcWindow;
RECT rcRestored;
UINT showCmd;
} sCefMainWindowData;
// constants
static const wchar_t kWindowClassname[] = L"CEFCLIENT";
static const wchar_t kWindowPostionFolder[] = L"Window Position";
static const wchar_t kPrefLeft[] = L"Left";
static const wchar_t kPrefTop[] = L"Top";
static const wchar_t kPrefWidth[] = L"Width";
static const wchar_t kPrefHeight[] = L"Height";
static const wchar_t kPrefRestoreLeft[] = L"Restore Left";
static const wchar_t kPrefRestoreTop[] = L"Restore Top";
static const wchar_t kPrefRestoreRight[] = L"Restore Right";
static const wchar_t kPrefRestoreBottom[] = L"Restore Bottom";
static const wchar_t kPrefShowState[] = L"Show State";
static const long kMinWindowWidth = 390;
static const long kMinWindowHeight = 200;
// Globals
static wchar_t kCefWindowClosingPropName[] = L"CLOSING";
// The Main Window's window class init helper
ATOM cef_main_window::RegisterWndClass()
{
static ATOM classAtom = 0;
if (classAtom == 0)
{
DWORD menuId = IDC_CEFCLIENT;
WNDCLASSEX wcex;
::ZeroMemory (&wcex, sizeof (wcex));
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_SAVEBITS;
wcex.lpfnWndProc = ::DefWindowProc;
wcex.hInstance = ::hInst;
wcex.hIcon = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_CEFCLIENT));
wcex.hCursor = ::LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = MAKEINTRESOURCE(menuId);
wcex.lpszClassName = ::kWindowClassname;
wcex.hIconSm = ::LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
classAtom = RegisterClassEx(&wcex);
}
return classAtom;
}
cef_main_window::cef_main_window()
{
}
cef_main_window::~cef_main_window()
{
}
// Loads the window title from resource string
LPCWSTR cef_main_window::GetBracketsWindowTitleText()
{
bool intitialized = false;
static wchar_t szTitle[100] = L"";
if (!intitialized) {
intitialized = (::LoadString(::hInst, IDS_APP_TITLE, szTitle, _countof(szTitle) - 1) > 0);
}
return szTitle;
}
// Create Method. Call this to create a cef_main_window instance
BOOL cef_main_window::Create()
{
RegisterWndClass();
int showCmd = SW_SHOW;
LoadWindowRestoreRect(showCmd);
DWORD styles = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_EX_COMPOSITED;
if (showCmd == SW_MAXIMIZE)
styles |= WS_MAXIMIZE;
if (!cef_host_window::Create(::kWindowClassname, GetBracketsWindowTitleText(), styles,
mWindowRect.left, mWindowRect.top, mWindowRect.right, mWindowRect.bottom))
{
return FALSE;
}
RestoreWindowPlacement(showCmd);
UpdateWindow();
return TRUE;
}
// PostNcDestroy override
void cef_main_window::PostNcDestroy()
{
cef_host_window::PostNcDestroy();
// We get this notification after the window
// has been destroyed so we need to delete ourself
delete this;
#ifdef DARK_UI
// After the main window is destroyed
// do final cleanup...
DoFinalCleanup();
#endif
}
// Helper to get the browser
const CefRefPtr<CefBrowser> cef_main_window::GetBrowser()
{
return g_handler->GetBrowser();
}
// WM_CREATE handler
BOOL cef_main_window::HandleCreate()
{
cef_host_window::HandleCreate();
// Create the single static handler class instance
g_handler = new ClientHandler();
g_handler->SetMainHwnd(mWnd);
RECT rect;
GetBrowserRect(rect);
CefWindowInfo info;
CefBrowserSettings settings;
settings.web_security = STATE_DISABLED;
// Initialize window info to the defaults for a child window
info.SetAsChild(mWnd, rect);
// Creat the new child browser window
CefBrowserHost::CreateBrowser(info,
static_cast<CefRefPtr<CefClient> >(g_handler),
::AppGetInitialURL(), settings, NULL);
return TRUE;
}
// WM_ERASEBKGND handler
BOOL cef_main_window::HandleEraseBackground(HDC hdc)
{
return (SafeGetCefBrowserHwnd() != NULL);
}
// WM_SETFOCUS handler
BOOL cef_main_window::HandleSetFocus(HWND hLosingFocus)
{
// Pass focus to the browser window
CefWindowHandle hwnd = SafeGetCefBrowserHwnd();
if (hwnd)
{
::PostMessage(hwnd, WM_SETFOCUS, (WPARAM)hLosingFocus, NULL);
return TRUE;
}
return FALSE;
}
// WM_PAINT handler
BOOL cef_main_window::HandlePaint()
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(&ps);
#if defined(DARK_AERO_GLASS) && defined (DARK_UI)
DoPaintNonClientArea(hdc);
#endif
EndPaint(&ps);
return TRUE;
}
// WM_GETMINMAXINFO handler
BOOL cef_main_window::HandleGetMinMaxInfo(LPMINMAXINFO mmi)
{
mmi->ptMinTrackSize.x = ::kMinWindowWidth;
mmi->ptMinTrackSize.y = ::kMinWindowHeight;
return TRUE;
}
// WM_CLOSE handler
BOOL cef_main_window::HandleClose()
{
SaveWindowRestoreRect();
CefWindowHandle hwnd = SafeGetCefBrowserHwnd();
if (hwnd)
{
BOOL closing = (BOOL)::GetProp(hwnd, ::kCefWindowClosingPropName);
if (closing)
{
if (!g_handler->CanCloseBrowser(GetBrowser())) {
PostMessage(WM_CLOSE, 0 ,0);
return TRUE;
}
::RemoveProp(hwnd, ::kCefWindowClosingPropName);
}
else
{
g_handler->QuittingApp(true);
g_handler->DispatchCloseToNextBrowser();
return TRUE;
}
}
return FALSE;
}
// WM_COMMAND/IDM_EXIT handler
BOOL cef_main_window::HandleExitCommand()
{
if (g_handler.get())
{
g_handler->QuittingApp(true);
g_handler->DispatchCloseToNextBrowser();
}
else
{
DestroyWindow();
}
return TRUE;
}
// WM_COMMAND handler
BOOL cef_main_window::HandleCommand(UINT commandId)
{
switch (commandId)
{
case IDM_EXIT:
return HandleExitCommand();
default:
return DoCommand(commandId);
}
}
// Tear down helper --
// Writes the restore window placement data to the registry
void cef_main_window::SaveWindowRestoreRect()
{
WINDOWPLACEMENT wp;
::ZeroMemory(&wp, sizeof(wp));
wp.length = sizeof(wp);
if (GetWindowPlacement(&wp))
{
// Only save window positions for "restored" and "maximized" states.
// If window is closed while "minimized", we don't want it to open minimized
// for next session, so don't update registry so it opens in previous state.
if (wp.showCmd == SW_SHOWNORMAL || wp.showCmd == SW_SHOW || wp.showCmd == SW_MAXIMIZE)
{
RECT rect;
if (GetWindowRect(&rect))
{
mWindowRect.left = rect.left;
mWindowRect.top = rect.top;
mWindowRect.right = ::RectWidth(rect);
mWindowRect.bottom = ::RectHeight(rect);
}
if (wp.showCmd == SW_MAXIMIZE)
{
// When window is maximized, we also store the "restore" size
mRestoredRect.left = wp.rcNormalPosition.left;
mRestoredRect.top = wp.rcNormalPosition.top;
mRestoredRect.right = wp.rcNormalPosition.right;
mRestoredRect.bottom = wp.rcNormalPosition.bottom;
}
if (!ClientApp::IsPortableInstall())
{
// for normal installations, serialize to the Registry
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefLeft, mWindowRect.left);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefTop, mWindowRect.top);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefWidth, mWindowRect.right);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefHeight, mWindowRect.bottom);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefRestoreLeft, mRestoredRect.left);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefRestoreTop, mRestoredRect.top);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefRestoreRight, mRestoredRect.right);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefRestoreBottom, mRestoredRect.bottom);
::WriteRegistryInt(::kWindowPostionFolder, ::kPrefShowState, (wp.showCmd == SW_MAXIMIZE) ? SW_MAXIMIZE : SW_SHOW);
}
else
{
// for portable installations, serialize to a file in the app folder
sCefMainWindowData data;
memset(&data, 0, sizeof(sCefMainWindowData));
strcpy(data.szSignature, MAKEPORTABLE_BRACKETS_SIGNATURE_STRING);
data.uVersion = MAKEPORTABLE_BRACKETS_VERSION_CURRENT;
data.rcWindow = mWindowRect;
data.rcRestored = mRestoredRect;
data.showCmd = wp.showCmd;
std::wstring filename;
ClientApp::GetPortableInstallFilename(filename);
HANDLE hFile = ::CreateFile(filename.c_str(), GENERIC_WRITE,
FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE != hFile)
{
DWORD dwBytesWritten = 0L;
::WriteFile(hFile, (LPVOID)&data, sizeof(data), &dwBytesWritten, NULL);
::CloseHandle(hFile);
}
}
}
}
}
// Initialization helper --
// Loads the restore window placement data from the registry
void cef_main_window::LoadWindowRestoreRect(int& showCmd)
{
// set defaults
::SetRect(&mWindowRect, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT);
showCmd = SW_SHOW;
::SetRect(&mRestoredRect, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT);
if (!ClientApp::IsPortableInstall())
{
// for normal installations, serialize to the Registry
::GetRegistryInt(::kWindowPostionFolder, ::kPrefLeft, NULL, (int&)mWindowRect.left);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefTop, NULL, (int&)mWindowRect.top);
// stuff the width and height into the right and bottom fields
::GetRegistryInt(::kWindowPostionFolder, ::kPrefWidth, NULL, (int&)mWindowRect.right);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefHeight, NULL, (int&)mWindowRect.bottom);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefShowState, NULL, showCmd);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreLeft, NULL, (int&)mRestoredRect.left);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreTop, NULL, (int&)mRestoredRect.top);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreRight, NULL, (int&)mRestoredRect.right);
::GetRegistryInt(::kWindowPostionFolder, ::kPrefRestoreBottom, NULL, (int&)mRestoredRect.bottom);
}
else
{
// for portable installations, serialize to a file in the app folder
std::wstring filename;
ClientApp::GetPortableInstallFilename(filename);
HANDLE hFile = ::CreateFile(filename.c_str(), GENERIC_READ,
FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (INVALID_HANDLE_VALUE != hFile)
{
DWORD dwFileSize = ::GetFileSize(hFile, NULL);
DWORD dwBytesRead;
sCefMainWindowData data;
if ((sizeof(sCefMainWindowData) == dwFileSize)
&& ::ReadFile(hFile, (LPVOID)&data, sizeof(sCefMainWindowData), &dwBytesRead, NULL)
&& (dwBytesRead == sizeof(sCefMainWindowData))
&& (strcmp(data.szSignature, MAKEPORTABLE_BRACKETS_SIGNATURE_STRING) == 0))
{
if (data.uVersion <= MAKEPORTABLE_BRACKETS_VERSION_1)
{
mWindowRect = data.rcWindow;
mRestoredRect = data.rcRestored;
showCmd = data.showCmd;
}
// future version struct additions go here...
// if (data.uVersion <= MAKEPORTABLE_BRACKETS_VERSION_xx) { }
}
::CloseHandle(hFile);
}
}
}
// Initialization helper --
// Loads the Restores data and positions the window in its previously saved state
void cef_main_window::RestoreWindowPlacement(int showCmd)
{
if (showCmd == SW_MAXIMIZE)
{
WINDOWPLACEMENT wp;
::ZeroMemory(&wp, sizeof (wp));
wp.length = sizeof(WINDOWPLACEMENT);
wp.flags = 0;
wp.showCmd = SW_MAXIMIZE;
wp.ptMinPosition.x = -1;
wp.ptMinPosition.y = -1;
wp.ptMaxPosition.x = -1;
wp.ptMaxPosition.y = -1;
wp.rcNormalPosition = mRestoredRect;
// This returns FALSE on failure but not sure what we could do in that case
SetWindowPlacement(&wp);
}
ShowWindow(showCmd);
}
// WM_COPYDATA handler
BOOL cef_main_window::HandleCopyData(HWND, PCOPYDATASTRUCT lpCopyData)
{
if ((lpCopyData) && (lpCopyData->dwData == ID_WM_COPYDATA_SENDOPENFILECOMMAND) && (lpCopyData->cbData > 0)) {
// another Brackets instance requests that we open the given files/folders
std::wstring wstrFilename = (LPCWSTR)lpCopyData->lpData;
std::wstring wstrFileArray = L"[";
bool hasMultipleFiles = false;
if (wstrFilename.find('"') != std::wstring::npos) {
if (wstrFilename.find(L"\" ") != std::wstring::npos ||
(wstrFilename.front() != '"' || wstrFilename.back() != '"')) {
hasMultipleFiles = true;
}
} else {
hasMultipleFiles = (wstrFilename.find(L" ") != std::wstring::npos);
}
if (hasMultipleFiles) {
std::size_t curFilePathEnd1 = wstrFilename.find(L" ");
std::size_t curFilePathEnd2 = wstrFilename.find(L"\" ");
std::size_t nextQuoteIndex = wstrFilename.find(L"\"");
while ((nextQuoteIndex == 0 && curFilePathEnd2 != std::wstring::npos) ||
(nextQuoteIndex != 0 && curFilePathEnd1 != std::wstring::npos)) {
if (nextQuoteIndex == 0 && curFilePathEnd2 != std::wstring::npos) {
// Appending a file path that is already wrapped in double-quotes.
wstrFileArray += (wstrFilename.substr(0, curFilePathEnd2 + 1) + L",");
// Strip the current file path and move index to next file path.
wstrFilename = wstrFilename.substr(curFilePathEnd2 + 2);
} else {
// Explicitly wrap a file path in double-quotes and append it to the file array.
wstrFileArray += (L"\"" + wstrFilename.substr(0, curFilePathEnd1) + L"\",");
// Strip the current file path and move index to next file path.
wstrFilename = wstrFilename.substr(curFilePathEnd1 + 1);
}
curFilePathEnd1 = wstrFilename.find(L" ");
curFilePathEnd2 = wstrFilename.find(L"\" ");
nextQuoteIndex = wstrFilename.find(L"\"");
}
}
// Add the last file or the only file into the file array.
if (wstrFilename.front() == '"' && wstrFilename.back() == '"') {
wstrFileArray += wstrFilename;
} else if (wstrFilename.length()) {
wstrFileArray += (L"\"" + wstrFilename + L"\"");
}
wstrFileArray += L"]";
g_handler->SendOpenFileCommand(g_handler->GetBrowser(), CefString(wstrFileArray.c_str()));
return TRUE;
}
return FALSE;
}
// EnumWindowsProc callback function
// - searches for an already running Brackets application window
BOOL CALLBACK cef_main_window::FindSuitableBracketsInstanceHelper(HWND hwnd, LPARAM lParam)
{
if (lParam == NULL)
return FALSE;
// check for the Brackets application window by class name and title
WCHAR cName[MAX_PATH+1] = {0}, cTitle[MAX_PATH+1] = {0};
::GetClassName(hwnd, cName, MAX_PATH);
::GetWindowText(hwnd, cTitle, MAX_PATH);
if ((wcscmp(cName, ::kWindowClassname) == 0) && (wcsstr(cTitle, GetBracketsWindowTitleText()) != 0)) {
// found an already running instance of Brackets. Now, check that that window
// isn't currently disabled (eg. modal dialog). If it is keep searching.
if ((::GetWindowLong(hwnd, GWL_STYLE) & WS_DISABLED) == 0) {
//return the window handle and stop searching
*(HWND*)lParam = hwnd;
return FALSE;
}
}
return TRUE; // otherwise, continue searching
}
// Locates a top level instance of Brackets already running
HWND cef_main_window::FindFirstTopLevelInstance()
{
HWND hFirstInstanceWnd = NULL;
::EnumWindows(FindSuitableBracketsInstanceHelper, (LPARAM)&hFirstInstanceWnd);
return hFirstInstanceWnd;
}
// WM_SIZE handler
BOOL cef_main_window::HandleSize(BOOL bMinimize)
{
CefWindowHandle hwnd = SafeGetCefBrowserHwnd();
if (!hwnd)
return FALSE;
RECT rect;
GetBrowserRect(rect);
// Minimizing the window to 0x0 which causes our layout to go all
// screwy, so we just ignore it.
if (!bMinimize)
{
HDWP hdwp = ::BeginDeferWindowPos(1);
hdwp = ::DeferWindowPos(hdwp, hwnd, NULL, rect.left, rect.top, ::RectWidth(rect), ::RectHeight(rect), SWP_NOZORDER);
::EndDeferWindowPos(hdwp);
}
return FALSE;
}
// WindowProc -- Dispatches and routes window messages
LRESULT cef_main_window::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CREATE:
if (HandleCreate())
return 0L;
break;
case WM_ERASEBKGND:
if (HandleEraseBackground((HDC)wParam))
return 1L;
break;
case WM_SETFOCUS:
if (HandleSetFocus((HWND)wParam))
return 0L;
break;
case WM_PAINT:
if (HandlePaint())
return 0L;
break;
case WM_DESTROY:
return 0L; // Do not handle the destroy here.
break;
case WM_CLOSE:
if (HandleClose())
return 0L;
break;
case WM_SIZE:
if (HandleSize(wParam == SIZE_MINIMIZED))
return 0L;
break;
case WM_COMMAND:
if (HandleCommand(LOWORD(wParam)))
return 0L;
break;
case WM_COPYDATA:
if (HandleCopyData((HWND)wParam, (PCOPYDATASTRUCT)lParam))
return 0L;
break;
}
LRESULT lr = cef_host_window::WindowProc(message, wParam, lParam);
switch (message)
{
case WM_GETMINMAXINFO:
HandleGetMinMaxInfo((LPMINMAXINFO) lParam);
break;
}
return lr;
}