How can I query the location of the taskbar on secondary monitors?

Raymond Chen

A customer wanted to know how to get the location of the taskbar on secondary monitors. “I know that SHApp­Bar­Message will tell me the location of the taskbar on the primary monitor, but how do I get its location on secondary monitors?” We asked the customer what their actual problem is, where they think that determining the taskbar location on secondary monitors is the solution. The customer was kind enough to explain.

Our application shows a small window, and sometimes users move it behind the taskbar. They then complain that they can’t find it, and they have to move their taskbar out of the way in order to find it again. We want our window to automatically avoid the taskbar.

The solution to the customer’s problem is to stop obsessing about the taskbar. Use the Get­Monitor­Info function to obtain the working area for the monitor the window is on. The window can then position itself inside the working area. The working area is the part of the monitor that is not being used by the taskbar or other application bars. The customer was too focused on avoiding the taskbar and missed the fact that they needed to avoid other taskbar-like windows as well.

The customer was kind enough to write back to confirm that Get­Monitor­Info was working.

0 comments

Discussion is closed.

Feedback usabilla icon