Click here to Skip to main content
16,016,744 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an running c# application; when I press the Windows button, the taskbar appears, of which does not affect the program. That's great. But how can I do the following...
1) Detect if the taskbar is present.
2) if so, from where will the taskbar appear from?
the bottom, or top, or from either side?
3) is it visible or not.
4) And, what is the C# equivalent code that's behind the
windows bottom on your keyboard.
Or in otherwords, lets the C# equivalent code do the work for us.

Yes, I've gone thru quite a bit of code related to the taskbar and it a little bit overwhelming - not knowing where to start.

The windows button I'm referring to, is the button with the Microsoft's picture of the four paned window. -- when pressed, it pulls up the taskbar.


Thanks for any help.

What I have tried:

browse the C# code here within this site, not knowing how to make heads or tails of it all. Thanks.
Posted
Updated 15-May-24 8:15am
v2
Comments
Dave Kreskowiak 15-May-24 15:10pm    
Why would you do this? If the user hits the button and the task bar shows up, it's temporary and the task bar will hide on its own.

Why and how does the existence of the task bar impact your app?
snorkie 15-May-24 16:05pm    
It looks like a very similar question was asked and answered on this site. This should lead you towards what you need to do.
https://www.codeproject.com/Questions/40990/Detecting-if-a-key-is-pressed-outside-the-key-even
samtoad 16-May-24 8:51am    
OK, Dave...

I'll rewrite the question for clarity. Where can I find C# code, when executed, makes the taskbar pop up. -- so a user can get access to any item contained within the taskbar?

1 solution

Get the primary screen's working area and bounds.  If they're the same, the taskbar isn't visible; otherwise it is.  You can use their values to determine the position of the taskbar.
  • Screen.PrimaryScreen.WorkingArea
  • Screen.PrimaryScreen.Bounds
/ravi
 
Share this answer
 
Comments
samtoad 17-May-24 16:26pm    
I found a working answer to my question, and thanks. And within my app, it works.

IntPtr hWndTray = FindWindow("Shell_TrayWnd", null);
SetWindowPos(hWndTray, IntPtr.Zero, 0, 0, 0, 0, SWP_NOZORDER |
SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED | SWP_SHOWWINDOW);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900