Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4057780
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:59:46+00:00 2026-05-20T14:59:46+00:00

I have a window, which I SetWindowPos(window, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED); It

  • 0

I have a window, which I SetWindowPos(window, HWND_TOP, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_FRAMECHANGED);

It covers the whole screen, ok, but it takes a while (0.5 sec) to cover the taskbar as well.

Is there a way to come over the taskbar immediately? I found that setting HWND_TOPMOST does it immediately, but it stays above all the other windows, even if I switch the app – this is something I don’t want. Also, if I first hide the window and then show it, it somehow forces the window to redraw and covers the taskbar immediately, but it flickers (because of the hiding). Is there another way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:59:47+00:00Added an answer on May 20, 2026 at 2:59 pm

    Edit 2. There is even a better way for doing fullscreen, the chromium way, source taken from here:

    http://src.chromium.org/viewvc/chrome/trunk/src/ui/views/win/fullscreen_handler.cc?revision=HEAD&view=markup

    void FullscreenHandler::SetFullscreenImpl(bool fullscreen, bool for_metro) {
      ScopedFullscreenVisibility visibility(hwnd_);
    
      // Save current window state if not already fullscreen.
      if (!fullscreen_) {
        // Save current window information.  We force the window into restored mode
        // before going fullscreen because Windows doesn't seem to hide the
        // taskbar if the window is in the maximized state.
        saved_window_info_.maximized = !!::IsZoomed(hwnd_);
        if (saved_window_info_.maximized)
          ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_RESTORE, 0);
        saved_window_info_.style = GetWindowLong(hwnd_, GWL_STYLE);
        saved_window_info_.ex_style = GetWindowLong(hwnd_, GWL_EXSTYLE);
        GetWindowRect(hwnd_, &saved_window_info_.window_rect);
      }
    
      fullscreen_ = fullscreen;
    
      if (fullscreen_) {
        // Set new window style and size.
        SetWindowLong(hwnd_, GWL_STYLE,
                      saved_window_info_.style & ~(WS_CAPTION | WS_THICKFRAME));
        SetWindowLong(hwnd_, GWL_EXSTYLE,
                      saved_window_info_.ex_style & ~(WS_EX_DLGMODALFRAME |
                      WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
    
        // On expand, if we're given a window_rect, grow to it, otherwise do
        // not resize.
        if (!for_metro) {
          MONITORINFO monitor_info;
          monitor_info.cbSize = sizeof(monitor_info);
          GetMonitorInfo(MonitorFromWindow(hwnd_, MONITOR_DEFAULTTONEAREST),
                         &monitor_info);
          gfx::Rect window_rect(monitor_info.rcMonitor);
          SetWindowPos(hwnd_, NULL, window_rect.x(), window_rect.y(),
                       window_rect.width(), window_rect.height(),
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
        }
      } else {
        // Reset original window style and size.  The multiple window size/moves
        // here are ugly, but if SetWindowPos() doesn't redraw, the taskbar won't be
        // repainted.  Better-looking methods welcome.
        SetWindowLong(hwnd_, GWL_STYLE, saved_window_info_.style);
        SetWindowLong(hwnd_, GWL_EXSTYLE, saved_window_info_.ex_style);
    
        if (!for_metro) {
          // On restore, resize to the previous saved rect size.
          gfx::Rect new_rect(saved_window_info_.window_rect);
          SetWindowPos(hwnd_, NULL, new_rect.x(), new_rect.y(),
                       new_rect.width(), new_rect.height(),
                       SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
        }
        if (saved_window_info_.maximized)
          ::SendMessage(hwnd_, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
      }
    }
    

    Edit.
    It is probably better to create a fullscreen window as BrendanMcK pointed it out in a comment to this answer, see this link: http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx (“How do I cover the taskbar with a fullscreen window?”)

    The new code using the link above would be:

    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);
    }
    

    Old answer below – do not use it, stays only for the record on how NOT to do this.

    You have to hide taskbar and menubar to see fullscreen immediately.

    Here is the code (uses WTL), call SetFullScreen(true) to go into full screen mode:

    template <class T, bool t_bHasSip = true>
    class CFullScreenFrame
    {
    public:
        bool m_fullscreen;
        LONG m_windowstyles;
        WINDOWPLACEMENT m_windowplacement;
    
        CFullScreenFrame() 
            :
            m_fullscreen(false),
            m_windowstyles(0)
        { }
    
        void SetFullScreen(bool fullscreen)
        {
            ShowTaskBar(!fullscreen);
    
            T* pT = static_cast<T*>(this);
    
            if (fullscreen) {
                if (!m_fullscreen) {
                    m_windowstyles = pT->GetWindowLongW(GWL_STYLE);
                    pT->GetWindowPlacement(&m_windowplacement);
                }
    
            }
    
            // SM_CXSCREEN gives primary monitor, for multiple monitors use SM_CXVIRTUALSCREEN.
            RECT fullrect = { 0 };              
            SetRect(&fullrect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
    
            WINDOWPLACEMENT newplacement = m_windowplacement;
            newplacement.showCmd = SW_SHOWNORMAL;
            newplacement.rcNormalPosition = fullrect;
    
            if (fullscreen) {
                pT->SetWindowPlacement(&newplacement);
                pT->SetWindowLongW(GWL_STYLE,  WS_VISIBLE);
                pT->UpdateWindow();
            } else {
                if (m_fullscreen) {
                    pT->SetWindowPlacement(&m_windowplacement);
                    pT->SetWindowLongW(GWL_STYLE, m_windowstyles);
                    pT->UpdateWindow();
                }
            }
    
            m_fullscreen = fullscreen;
        }
    
        void ShowTaskBar(bool show)
        {
            HWND taskbar = FindWindow(_T("Shell_TrayWnd"), NULL);
            HWND start = FindWindow(_T("Button"), NULL);
    
            if (taskbar != NULL) {
                ShowWindow(taskbar, show ? SW_SHOW : SW_HIDE);
                UpdateWindow(taskbar);
            }
            if (start != NULL) { 
                // Vista
                ShowWindow(start, show ? SW_SHOW : SW_HIDE);
                UpdateWindow(start);
            }       
        }
    };
    

    You also have to add some code to WM_CLOSE message:

    case WM_CLOSE:
        ShowTaskBar(true);
    

    There is one caveat with this solution, if your application crashes or is killed through task manager, then user losses taskbar on his system permanently! (unless he runs your application again, goes into fullscreen and exits, then he will see the taskbar again).

    Earlier in my answer I pointed to “atlwince.h” but that function worked only on Windows CE, the one I pasted above works fine with XP, Vista and 7.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application window which covers the screen and there are several minor
I have a window which opens up on a button click. The window takes
I have a WPF Window which takes a lot of time to create and
I have a window which is hidden and I would like to send a
I have a window which has a custom NSView and has a bottom bar
i have a window which is like this <Window x:Class=pharmacy_Concept.MainWindow xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml Title=MainWindow Height=350
In my application I have a window which I popup with small messages on
I have a WPF Window which has a among other controls hosts a Frame.
I have a window application which uses SP classes to create a site. I
I'm trying to hide window after its startup. I have own window-class which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.