创建一个全屏的窗口

    技术2026-01-17  5

    全屏对大部分游戏client是必须的。方法如下:

    (1) 得到默认的Window styles, 去掉WS_DLGFRAME;

    (2) 获取当前Window rect,重新设置Window大小;

    (3) 最大化方式显示窗口。

     

    代码像下面这样:

    SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) & (~WS_DLGFRAME)); RECT rect; GetWindowRect(hWnd, &rect); SetWindowPos(hWnd, HWND_NOTOPMOST, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, SWP_FRAMECHANGED); ShowWindow(hWnd, SW_SHOWMAXIMIZED); UpdateWindow(hWnd);

     

     

    最新回复(0)