It seems that the core Win32 API Shell_NotifyIcon
sends a WM_LBUTTONDOWN
message when the user clicks the icon. According to MSDN anyway.
Examining the Windows Forms source code for NotifyIcon shows the standard mouse event handling, so if a Win32 message was sent at the "right" time, it will work the way you want / expect.
I have to agree with the previous comment that NotifyIcon will swallow WM_LBUTTONDOWN, since it needs to capture the mouse so that the user can drag and drop the icons.
It is possible that this article on creating a tray icon for WPF will be useful as it shows how to use SetWindowsHookEx
, etc. from c #.
source share