Tutorial :Bring Windows Taskbar to front when a fullscreen application is running



Question:

I have an app where I use a notifyicon to show some balloon tips. However, it will be running in an environment where there is always a separate main app running in full-screen mode. My problem is making the taskbar come to front - I thought it would automatically when there are balloon tips appearing on the notifyicon in the system tray.

Can I make the taskbar become visible over the app running in full-screen mode?

I have tried the following but it's not a case of hiding or unhiding the taskbar - it's a case of bringing it to the front or making the running app not full-screen...

int TaskBarHwnd = FindWindow("Shell_traywnd", "");  bool result1 = SetWindowPos(TaskBarHwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);   // Hide Taskbar  bool result1 = SetWindowPos(TaskBarHwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW); // Show Taskbar  

EDIT There must be a way of doing this - if I am watching a movie and my battery is low then the taskbar slides up and I get a notification about the battery. I need to find out what the OS does to get this behaviour...

EDIT It is worth saying that the sourcecode for the fullscreen app is under our control. This does change the question in fairness but I would still like to know a way of "interrupting" a fullscreen app regardless of whether you have control or not.


Solution:1

If it's no problem that the start menu will popup than you could press the windows button.

keybd_event(VK_LWIN, 0, 0, 0);  keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);  

Works fine for me under Windows 7.


Solution:2

From a purely technical point of view, this is a very interesting question. The first thing that comes to mind is by far not an elegant solution, but maybe a working solution - open the Start Menu:

SendMessage(hAnyWnd, WM_SYSCOMMAND, SC_TASKLIST, 0)  

I will see if I can find another solution.

(Well, the most obvious solution, of course, is to BringWindowToTop(hTaskBar), but that appears not to work.)


Solution:3

One way I'm looking at doing it now is by sending the escape key from my notifyicon app.

SendKeys.Send("{ESC}");  

This works as the standard behaviour for a fullscreen app is usually to exit the fullscreen mode when escape is hit on the keyboard. I still don't think this is the best solution because there may be times when forcing an ESC might have side effects if the user is doing something else...but it may well be "just good enough"


Solution:4

How about the other solution?

Not to make the main application full-screen: it will cover the whole screen view except the area where the taskbar is always positioned by default. If the taskbar is repositioned to other side, the application will be notified by OS to refresh its window size, but it will always avoid the new taskbar area. The worst case is when the taskbar is set auto-hidden. It will not look so nice though.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »