xiaoidea / 5minutebreak

Automatically exported from code.google.com/p/5minutebreak
0 stars 0 forks source link

More reliable fullscreen mode #14

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently going to fullscreen is accomplished by hiding the taskbar,
this is a wrong approach, if application crashes user might be left
without a taskbar. Read this post by Raymond Chen for a better method:

"How do I cover the taskbar with a fullscreen window?"
http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx

The code is:

    HWND CreateFullscreenWindow(HWND hwnd)
    {
     HMONITOR hmon = MonitorFromWindow(hwnd,
                                       MONITOR_DEFAULTTONEAREST);
     MONITORINFO mi = { sizeof(mi) };
     if (!GetMonitorInfo(hmon, &mi)) return NULL;
     return CreateWindow(TEXT("static"),
           TEXT("something interesting might go here"),
           WS_POPUP | WS_VISIBLE,
           mi.rcMonitor.left,
           mi.rcMonitor.top,
           mi.rcMonitor.right - mi.rcMonitor.left,
           mi.rcMonitor.bottom - mi.rcMonitor.top,
           hwnd, NULL, g_hinst, 0);
    }

Yet another way (Chrome Browser uses it):

http://stackoverflow.com/questions/2382464/win32-full-screen-and-hiding-taskbar/
5299718#5299718

Original issue reported on code.google.com by czarek.t...@gmail.com on 26 Jan 2013 at 2:29

GoogleCodeExporter commented 9 years ago

Original comment by czarek.t...@gmail.com on 26 Jan 2013 at 2:29