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
|
void MainFrame::GoFullScreen(HWND hwnd)
{
LONG wstyle;
RECT rc = {0};
/* You may want to save the original window rectangle
and menu for restoring */
// orig_menu = GetMenu(hwnd);
// orig_rc = GetWindowRect(hwnd);
wstyle = GetWindowLong(hwnd, GWL_STYLE);
wstyle &= ~(WS_BORDER|WS_CAPTION|WS_THICKFRAME);
SetWindowLong(hwnd, GWL_STYLE, wstyle);
/* If you don't want a menu either: */
SetMenu(hwnd, NULL);
/* Now, fill a rect with the full coordinates of the screen. Note
that you will need to decide *which* monitor on
multi-monitor systems. If that's not a concern, just use: */
SetRect(&rc, GetSystemMetrics(SM_XVIRTUALSCREEN),
GetSystemMetrics(SM_YVIRTUALSCREEN),
GetSystemMetrics(SM_CXVIRTUALSCREEN),
GetSystemMetrics(SM_CYVIRTUALSCREEN));
/* Resize the window to fit the screen: */
SetWindowPos(hwnd, NULL, rc.left, rc.top, rc.right,rc.bottom, SWP_NOZORDER);
} |
Partager