I am using python 2.7 (32-bit) on a 64-bit Windows 7 machine. I am using win32 Api to automate some Windows tasks, I am also new to python and win32 api. I saw similar questions, but not in python, and I was unable to understand the code and, unfortunately, I am new here, so I can not comment and ask questions, because my representative is less than 50, so I had to ask my own question.
Recently, I have been working with the system tray (notification area). I clicked (left or right) on any icon in the tray by name.
Now I need help accessing the context menu items after right clicking.
Therefore, when I make a right click, a popup menu appears . I am trying to get a pen so that I can click on its elements or content, and I get an error message, considering this an invalid menu handle. If I try win32gui.GetSubMenu, it will not work, win32gui.GetMenu will fail, something as simple as win32gui.GetMenuItemCount returns -1, I need help on how to access such a menu, navigate dropped it and clicked the item.
Snippet of code I tried:
tb = getNotificationAreaToolbar()
clickSystemTrayIcon('right', 'AMD HDMI Output', tb)
hPopupmenu = win32gui.FindWindow("#32768", "")
count = win32gui.GetMenuItemCount(hPopupMenu)
win32gui.PostMessage(tb, win32con.WM_COMMAND, win32gui.GetMenuItemId(hPopupmenu,1) , 0)
Any help gratefully thanks you!