How to find Windows Taskbar location and size? [duplicate]
Asked Answered
c#
H

1

4

I have created an application that runs in the system tray. When the user single- clicks the try icon, a small form comes up in the bottom right corner of the screen, i.e. right above the system tray. The form is basically "sticky" to the tray.

Here is my question: How do I accomplish the same thing, even if the user has the taskbar docked somewhere else? Like at the top of the screen, or one of the sides?

It shouldn't be hard, since I figure all I have to do is find out where the taskbar is. Is it at the bottom, the top, or one of the sides. But I can't find any documentation anywhere, that explains how to get the location and position of the taskbar.

Any one has any idea about this ?

Holds answered 12/8, 2009 at 10:25 Comment(0)
G
1

It's a window, so find it's HWND and then get the window coordinates. The class name you're looking for is "TrayNotifyWnd".

Guess answered 12/8, 2009 at 10:30 Comment(2)
Could u please elaberate some more on this regard ?Holds
This is wrong for several reasons: 1. It is Shell_TrayWnd, not TrayNotifyWnd, that is the System Tray, which is a child of the Task Bar, and 2. GetWindowPlacement doesn't actually work right, you need to call out to Shell32.dll and get the actual taskbar position. See the answer linked here: #1264906Decrement

© 2022 - 2024 — McMap. All rights reserved.