2 hzg392622955 hzg392622955 于 2016.05.06 15:54 提问

win32全屏覆盖任务栏无效

void EnterFullScreen(WindowInfo* win, bool presentation)
{
HWND hwnd = FindWindow(NULL, L"DetailShow");
HWND hwnd1 = ::GetParent(win->hwndFrame);
if (!hwnd)
return;

if (!HasPermission(Perm_FullscreenAccess) || gPluginMode)
    return;

if ((presentation ? win->presentation : win->isFullScreen) || !IsWindowVisible(hwnd))
    return;

AssertCrash(presentation ? !win->isFullScreen : !win->presentation);
if (presentation) {
    AssertCrash(win->ctrl);
    if (!win->IsDocLoaded())
        return;

    if (IsZoomed(hwnd))
        win->windowStateBeforePresentation = WIN_STATE_MAXIMIZED;
    else
        win->windowStateBeforePresentation = WIN_STATE_NORMAL;
    win->presentation = PM_ENABLED;

    SetTimer(win->hwndCanvas, HIDE_CURSOR_TIMER_ID, HIDE_CURSOR_DELAY_IN_MS, nullptr);
}
else {
    win->isFullScreen = true;
}

// ToC and Favorites sidebars are hidden when entering presentation mode
// TODO: make showFavorites a per-window pref
bool showFavoritesTmp = gGlobalPrefs->showFavorites;
if (presentation && (win->tocVisible || gGlobalPrefs->showFavorites)) {
    SetSidebarVisibility(win, false, false);
}

long ws = GetWindowLong(hwnd, GWL_STYLE);
if (!presentation || !win->isFullScreen)
    win->nonFullScreenWindowStyle = ws;
// remove window styles that add to non-client area
ws &= ~(WS_CAPTION | WS_THICKFRAME);
ws |= WS_MAXIMIZE;

win->nonFullScreenFrameRect = WindowRect(hwnd);
RectI rect = GetFullscreenRect(hwnd);

SetMenu(hwnd, nullptr);
ShowWindow(win->hwndReBar, SW_HIDE);
ShowWindow(win->hwndTabBar, SW_HIDE);
ShowWindow(win->hwndCaption, SW_HIDE);
SetWindowLong(hwnd, GWL_STYLE, ws);
SetWindowPos(hwnd, nullptr, rect.x, rect.y, rect.dx, rect.dy, SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOZORDER);
ShowWindow(hwnd, SW_SHOWMAXIMIZED);
if (presentation)
    win->ctrl->SetPresentationMode(true);

// Make sure that no toolbar/sidebar keeps the focus
SetFocus(hwnd);
// restore gGlobalPrefs->showFavorites changed by SetSidebarVisibility()
gGlobalPrefs->showFavorites = showFavoritesTmp;

}

2个回答

CSDNXIAOD
CSDNXIAOD   2016.05.06 16:02

MFC对话框窗口全屏 并覆盖任务栏
win32窗口全屏
win32全屏的方法
----------------------biu~biu~biu~~~在下问答机器人小D,这是我依靠自己的聪明才智给出的答案,如果不正确,你来咬我啊!

caozhy
caozhy   Ds   Rxr 2016.05.06 23:44

用setwindowpos swp_topmost将你的窗口置顶看看

hzg392622955
hzg392622955 你说的这种方法有试过,但是还是没有作用,可能我们的界面本身就比较奇葩,写测试demo的时候很容易实现这样的效果,而且基本上没有什么技术难度,但是我们的界面里面到处都类似这种坑
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!