Reputation: 8000
Can any body tell me how to handle events for System tray in windows.
I mean, when some body clicks on the system tray icon then I want to check whether to enable the application or not. Is there any way to capture events corresponding to system tray click.
Upvotes: 1
Views: 2795
Reputation: 8704
CodeProject about NotifyIcon
MSDN about NotifyIcon
Click Occurs when the user clicks the icon in the status area.
DoubleClick Occurs when the user double-clicks the icon in the status notification area of the taskbar.
MouseDown Occurs when the user presses the mouse button while the pointer is over the icon in the status notification area of the taskbar.
MouseMove Occurs when the user moves the mouse while the pointer is over the icon in the status notification area of the taskbar.
MouseUp Occurs when the user releases the mouse button while the pointer is over the icon in the status notification area of the taskbar.
Upvotes: 1
Reputation: 8644
In a .NET Forms Application the System Tray control { NotifyIcon } provides following Events to check what you want to achieve:
You can put the logic into these event handlers.
I hope this one helps out!
Upvotes: 3