I am a Python developer with a little knowledge of C++.
With that said, I would like to understand how I can right click on a system tray icon, and click on one of the options on the context menu.
I have looked around the internet and was unable to find something that can get me the location of the system tray icons relative to the 'Notification Area'. Also, I can get the Button text of the tray icon.
I get the handle of ToolbarWindow32
using FindWindowEx
.
I have tried to send WM_RBUTTONDOWN
and WM_RBUTTONUP
to the handle of ToolbarWindow32
with the X and Y coordinates, using SendMessage
and nothing happens.
I am completely oblivious as to how I can right click the icon, and get the context menu information, and using that, click on one of the options.
After my research there's no way to send a click message to a system tray icon, at least not through any API that I tried. The best way to do it and this is the way I'm following is the following:
Last step is now you want to send the click you make a call to win32api.mouse_event with x being: the left bound of the toolbar + half the width of the icon and y being: the top bound of the toolbar + half the height of the icon. (so you're sending the click to the center).
That's it hope it helps! I've asked a similar question and answered it here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.