int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPTSTR lpCmdLine, _In_ int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); // TODO: Place code here. MSG msg; HACCEL hAccelTable; CreateDeveloperConsole(); // Initialize global strings LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadString(hInstance, IDC_LAB4, szWindowClass, MAX_LOADSTRING); MyRegisterClass(hInstance); // Perform application initialization: if (!InitInstance (hInstance, nCmdShow)) { return FALSE; } hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_LAB4)); // Main message loop: while (GetMessage(&msg, NULL, 0, 0)) { if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { TranslateMessage(&msg); DispatchMessage(&msg); } } return (int) msg.wParam; }
void Application::Init() { INITCOMMONCONTROLSEX ctls; ctls.dwSize = sizeof(INITCOMMONCONTROLSEX); ctls.dwICC = ICC_BAR_CLASSES; InitCommonControlsEx(&ctls); CreateDeveloperConsole(); RECT rct; rct.left = 0; rct.top = 0; rct.right = 800; rct.bottom = 600; AdjustWindowRectEx(&rct, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, TRUE, WS_EX_OVERLAPPEDWINDOW); bool res = viewport.CreateEx(WS_EX_OVERLAPPEDWINDOW, L"Battleship", L"Battleship", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, rct.right - rct.left, rct.bottom - rct.top, NULL, NULL, GetModuleHandle(NULL)); if (!res) { throw Error("Could not create the window!"); } viewport.Show(SW_SHOW); viewport.Update(); }