Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to hide the taskbar with Win32 API on resize?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
12 replies to this topic

#1 shinypixel   Members   -  Reputation: 158

Like
0Likes
Like

Posted 07 May 2014 - 03:12 PM

I have a windowed app on Windows 7. I double click the title bar to make the window max the entire screen. The taskbar remains visible on the bottom, but this is undesired. I did some research, and this is what I came up with. However, the task bar is still showing. Any thoughts would be helpful. Thanks.

 

Edit: To clarify, this is for a fullscreen-windowed game that covers the taskbar, and not actually trying to kill the user's taskbar.

                    ShowWindow(g_hWnd, SW_HIDE);

                    LONG lStyle = GetWindowLong(g_hWnd, GWL_STYLE);
                    lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_SYSMENU);  
                    SetWindowLong(g_hWnd, GWL_STYLE, lStyle);
                    
                    LONG lExStyle = GetWindowLong(g_hWnd, GWL_EXSTYLE);
                    lExStyle &= WS_EX_APPWINDOW | WS_EX_TOPMOST;
                    SetWindowLong(g_hWnd, GWL_EXSTYLE, lExStyle);
   
                    SetWindowPos(g_hWnd, HWND_TOPMOST, 0,0,0,0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
                    ShowWindow(g_hWnd, SW_SHOW);

Edited by shinypixel, 07 May 2014 - 03:49 PM.


Sponsor:

#2 ApochPiQ   Moderators   -  Reputation: 16392

Like
3Likes
Like

Posted 07 May 2014 - 03:14 PM

Look up the MSDN documentation for SWP_NOZORDER and SWP_NOOWNERZORDER.



#3 shinypixel   Members   -  Reputation: 158

Like
0Likes
Like

Posted 07 May 2014 - 03:19 PM

Thanks, but even removing the two flags still show the taskbar, and oddly enough the task bar is somewhat cut off near the top.



#4 Buckeye   Crossbones+   -  Reputation: 6251

Like
4Likes
Like

Posted 07 May 2014 - 03:35 PM


this is undesired.

Why is it undesired?

 

A couple comments: if you're the only one using the app, you can set autohide for the taskbar; if you're working on an app for distribution, you should respect the user's desktop settings.

 

EDIT: If your app is intended for distribution, it may also be that the user has dual monitors, maximizes your app in the second monitor and the status of the taskbar is immaterial.


Edited by Buckeye, 07 May 2014 - 03:38 PM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#5 ApochPiQ   Moderators   -  Reputation: 16392

Like
5Likes
Like

Posted 07 May 2014 - 03:39 PM

Are your window dimensions actually large enough?

 

Also, I totally agree with Buckeye - apps that screw with my desktop settings are very, very annoying and likely to be uninstalled with extreme prejudice.



#6 shinypixel   Members   -  Reputation: 158

Like
0Likes
Like

Posted 07 May 2014 - 03:43 PM

Well, if you played Angry Birds on the Mac, a full screen game is actually a window. It covers the taskbar on the bottom. I'm trying the same for Windows.

 

I did auto-hide the taskbar, and the window dimensions were long enough.

 

So, I'm not trying to get rid of the taskbar, but trying to do a fullscreen-window feature that will cover the taskbar.

 

So far, the window is only partially above the top of the taskbar.


Edited by shinypixel, 07 May 2014 - 03:45 PM.


#7 Buckeye   Crossbones+   -  Reputation: 6251

Like
2Likes
Like

Posted 07 May 2014 - 03:50 PM


trying to do a fullscreen-window feature that will cover the taskbar.

"Full-screen" is different than "maximized." In Windows, setting full-screen mode results in the Window client area covering the entire monitor screen (no taskbar), and the window has no title-bar, no frame and no menu bar. Is that what you're trying to do?

 

EDIT:

 


So far, the window is only partially above the top of the task bar.

That's the auto-hide feature of the taskbar reserving a few pixels at the bottom of the screen to detect the mouse being moved down to bring up the taskbar. That's good!


Edited by Buckeye, 07 May 2014 - 03:57 PM.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.


#8 shinypixel   Members   -  Reputation: 158

Like
0Likes
Like

Posted 07 May 2014 - 04:05 PM

Yes. The issue is OpenGL won't render as a single buffer in fullscreen mode due to Aero, I believe. It does work when it's in windowed mode. So If I double click the title bar (or send a message to call WM_SIZE), I can get single buffering working as if it's full screen for the project's needs. If I auto-hide the taskbar, the window's dimensions cover the entire monitor, and the single buffer works. So, now I'm trying to cover the entire taskbar with the window when it's not in auto-hide.



#9 shinypixel   Members   -  Reputation: 158

Like
0Likes
Like

Posted 07 May 2014 - 04:09 PM

Someone suggested just making and drawing to an FBO (frame buffer object) and send that buffer to the back buffer, which gives the same feel as a single buffer. I haven't studied that far into OpenGL, so perhaps this is a better solution down the road than black magic with window manipulation. I was just thinking short-term with a window reaching the monitor's dimensions, but I can always just auto-hide the taskbar as I study until that point. Thanks for the idea on auto-hiding the taskbar as I study.

 

Edit: This ended up covering the taskbar for a full-screen window effect with single buffering, despite Aero, though I don't recommend it for real projects:

        LONG lStyle = GetWindowLong(win_getHandle(), GWL_STYLE);
            lStyle &= ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_SYSMENU);  
            SetWindowLong(win_getHandle(), GWL_STYLE, lStyle);
                       
            SetWindowPos(win_getHandle(), 0, 0, 0,     win.SystemInfo.DesktopResolution.right-1,     
                win.SystemInfo.DesktopResolution.bottom-1, SWP_SHOWWINDOW);
            MoveWindow(win_getHandle(), 0, 0, win.SystemInfo.DesktopResolution.right+1,
                win.SystemInfo.DesktopResolution.bottom+1, TRUE);

Edited by shinypixel, 07 May 2014 - 05:22 PM.


#10 SeanMiddleditch   Members   -  Reputation: 7148

Like
7Likes
Like

Posted 07 May 2014 - 07:23 PM

Just for everyone's edification: "windowed fullscreen" (sometimes also called "borderless windowed" or s few other things) is a feature a lot of users prefer. It avoids some wonky behavior with alt-tab and lets the user interact with the rest of the desktop more easily, especially with multiple monitors (eg I can go into a menu and get out of relative mouselook mode, move my cursor out of the window onto a second monitor to interact with Netflix, and then go back to the game, all with minimal fuss or waiting). It looks just like any other full-screen window but is not implemented the same. Many newer games have three options: Windowed, Fullscreen, and this third option.

#11 Endurion   Crossbones+   -  Reputation: 3683

Like
2Likes
Like

Posted 07 May 2014 - 11:56 PM

This might be interesting: http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx

 

Basically the task bar has some code behind it to notice if it should hide itself or stay visible, if you follow the blog entry you should find how to do it right.


Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

#12 Eliad Moshe   Members   -  Reputation: 813

Like
0Likes
Like

Posted 10 May 2014 - 08:22 PM

Try something like this:
 

    CreateWindowEx(WS_EX_TOPMOST,
                          "ClassName",
                          "Caption",
                          WS_VISIBLE | WS_POPUP
                          0, 0,    // the starting x and y positions should be 0
                          SCREEN_WIDTH, SCREEN_HEIGHT,
                          NULL,
                          NULL,
                          GetModuleHandle(NULL),
                          NULL);

Edited by Eliad Moshe, 12 May 2014 - 10:06 AM.


#13 Vortez   Crossbones+   -  Reputation: 2704

Like
0Likes
Like

Posted 11 May 2014 - 02:47 PM

You could have a look at my game window class in my 3d engine, that's how i do it. My guess is that you forgot the

CDS_FULLSCREEN

at line 110 in my code, in the ChangeDisplaySettings() function.

 

You don't need (or want) to hide the taskbar... with this code, the taskbar will be covered by the fullscreen window automagically.

 

I also agree that using a fbo for multiple resolutions is the way to go. It may cause stretching though, for example, when resizing the window in windowed mode.


Edited by Vortez, 11 May 2014 - 03:00 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS