comparison OSWindow.cpp @ 2459:e5c88c2b02ab

Audio_GetFirstHardwareDigitalDriver
author Ritor1
date Wed, 30 Jul 2014 11:19:53 +0600
parents 2a8010d99cf8
children 0f17a30149ec
comparison
equal deleted inserted replaced
2458:d53da932f594 2459:e5c88c2b02ab
399 399
400 400
401 bool OSWindow::Initialize(const wchar_t *title, int window_width, int window_height) 401 bool OSWindow::Initialize(const wchar_t *title, int window_width, int window_height)
402 { 402 {
403 WNDCLASSEXW wcxw; 403 WNDCLASSEXW wcxw;
404 wcxw.cbSize = sizeof(WNDCLASSEXW);
405 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
406 wcxw.lpfnWndProc = WinApiMsgRouter;
404 wcxw.cbClsExtra = 0; 407 wcxw.cbClsExtra = 0;
405 wcxw.cbSize = sizeof(wcxw);
406 wcxw.cbWndExtra = 0; 408 wcxw.cbWndExtra = 0;
407 wcxw.hbrBackground = (HBRUSH)(COLOR_BACKGROUND + 1);
408 wcxw.hCursor = nullptr;
409 wcxw.hIcon = wcxw.hIconSm = nullptr;
410 wcxw.hInstance = GetModuleHandleW(nullptr); 409 wcxw.hInstance = GetModuleHandleW(nullptr);
411 wcxw.lpfnWndProc = WinApiMsgRouter; 410 wcxw.hIcon = wcxw.hIconSm = LoadIcon(NULL, IDI_QUESTION);// nullptr;
411 wcxw.hCursor = LoadCursor(NULL, IDC_WAIT);//nullptr;
412 wcxw.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);//(COLOR_BACKGROUND + 1);
413 wcxw.lpszMenuName = nullptr;
412 wcxw.lpszClassName = L"M&MTrilogy"; 414 wcxw.lpszClassName = L"M&MTrilogy";
413 wcxw.lpszMenuName = nullptr;
414 wcxw.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
415 if (!RegisterClassExW(&wcxw)) 415 if (!RegisterClassExW(&wcxw))
416 return false; 416 return false;
417 417
418 api_handle = CreateWindowExW(0, wcxw.lpszClassName, title, 0, 418 api_handle = CreateWindowExW(NULL, wcxw.lpszClassName, title, 0,
419 ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_width) / 2), 419 ReadWindowsRegistryInt("window X", (GetSystemMetrics(SM_CXSCREEN) - window_width) / 2),
420 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_height) / 2), 420 ReadWindowsRegistryInt("window Y", (GetSystemMetrics(SM_CYSCREEN) - window_height) / 2),
421 window_width, window_height, nullptr, 421 window_width, window_height, nullptr,
422 nullptr, wcxw.hInstance, this); 422 nullptr, wcxw.hInstance, this);
423 if (!api_handle) 423 if (!api_handle)
457 return window; 457 return window;
458 } 458 }
459 459
460 460
461 461
462 LRESULT __stdcall OSWindow::WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) 462 LRESULT CALLBACK OSWindow::WinApiMsgRouter(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
463 { 463 {
464 if (msg == WM_NCCREATE) 464 if (msg == WM_NCCREATE)
465 { 465 {
466 CREATESTRUCTA* cs = (CREATESTRUCTA *)(lparam); 466 CREATESTRUCTA* cs = (CREATESTRUCTA *)(lparam);
467 OSWindow* window = (OSWindow *)cs->lpCreateParams; 467 OSWindow* window = (OSWindow *)cs->lpCreateParams;