diff --git a/api/graphics2_win.C b/api/graphics2_win.C index a29f239daa..f49b5761b3 100755 --- a/api/graphics2_win.C +++ b/api/graphics2_win.C @@ -87,7 +87,10 @@ void SetupPixelFormat(HDC hDC) { nPixelFormat = ChoosePixelFormat(hDC, &pfd); // This set pixel format to device context. - SetPixelFormat(hDC, nPixelFormat, &pfd); + BOOL flag = SetPixelFormat(hDC, nPixelFormat, &pfd); + if (!flag) { + DWORD x = GetLastError(); + } } static void make_window() { @@ -133,6 +136,7 @@ static void make_window() { hRC = wglCreateContext(hDC); if (hRC == 0) { + DWORD x = GetLastError(); ReleaseDC(hWnd, hDC); return; } @@ -319,6 +323,7 @@ void win_graphics_event_loop() { reg_win_class(); gfx_timer_id = SetTimer(NULL, 1, 30, (TIMERPROC)&timer_handler); + make_window(); while (1) { if (GetMessage(&msg,NULL,0,0)) { TranslateMessage(&msg); @@ -336,17 +341,16 @@ void boinc_graphics(int argc, char** argv) { fullscreen = true; } } - make_window(); win_graphics_event_loop(); } -int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) { - LPSTR command_line; - char* argv[100]; - int argc; - - command_line = GetCommandLine(); - argc = parse_command_line( command_line, argv ); - boinc_graphics(argc, argv); -} +int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) { + LPSTR command_line; + char* argv[100]; + int argc; + + command_line = GetCommandLine(); + argc = parse_command_line( command_line, argv ); + boinc_graphics(argc, argv); +}