MaxCoder88
MaxCoder88

Reputation: 2428

SystemTray Icon Coordinate - C#

How can I get those coordinates of Application Icon which is find in the Window taskbar's status area (a.k.a. System Tray) in C#?

Upvotes: 1

Views: 404

Answers (1)

David Heffernan
David Heffernan

Reputation: 613602

You cannot do this by fair means. No such API exists. There are, of course, various hacky ways to find it out, but I won't get into that.

Normally what you want to do is show a menu in response to a click on the tray icon. The message that Windows sends you when this happens contains the cursor coordinates where the click occurred. That's usually enough information to show whatever it is you show in response to the click.

In C# this translates to reading the coordinates out of the MouseEventArgs in NotifyIcon.MouseUp.

Upvotes: 1

Related Questions