I need to know whether the Windows taskbar is hidden or not. I believe there is no .NET method to do this, and also I have come across a lot of “how to hide and show the taskbar” samples, but I haven’t seen anything based on what I am looking for. I am not familiar with the Windows API, so I find it hard to understand traditional Windows code. Can someone please direct me to an article or type code telling whether the current state of the taskbar is hidden or not? I am coding in C#.
Thanks.
winSharp93 presents a helper class (“Find out Size (and position) of the taskbar“) that seems to work. It uses Win32’s SHAppBarMessage function.
Here’s the code (with minor additions) from his blog:
The author claims it works on his Windows 7 machine and it appears to work on my XP Pro machine.
Here’s how you might use it:
Where: tb.Size.Width and tb.Size.Height returns the width and height of the Taskbar, and tb.AutoHide returns true if the Taskbar is hidden and false if it is not.