| | |
Getting Menu Item info for pop-up menus from System Tray Icons
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2007
Posts: 1
Reputation:
Solved Threads: 0
I am trying to figure out a way of retrieving/enumerating menu items that pops up from one of my application system tray icons when I right click on it, and seeing which menu item is checked.
So far what I've done...
I've used Winspector to find that the tray icon itself for the application does not have its own window class, so I retrieved its handle through the "ToolbarWindow32" class, by getting a handle on the tray process, getting a count of the "Button"s inside the tray, and iterating through each one to find the application that I am trying to access.
If you take a look at the last if statement, I check whether the current icon is showing, and if it is it gets the handle to the menu. I'm not too sure whether doing GetMenu is actually getting the handle of the same menu as when I right click on it.
Basically, if I right click on the icon, it pops up a menu, and there is a menu item with a submenu with a list of items which can be checked. All I want to do see which ones is checked.
Thanks for any response in advance.
noit
So far what I've done...
I've used Winspector to find that the tray icon itself for the application does not have its own window class, so I retrieved its handle through the "ToolbarWindow32" class, by getting a handle on the tray process, getting a count of the "Button"s inside the tray, and iterating through each one to find the application that I am trying to access.
C++ Syntax (Toggle Plain Text)
for(int iButton=0; iButton<iButtonsCount; iButton++) { DWORD dwBytesRead = -1; TBBUTTON buttonData; SendMessage(hWndTray, TB_GETBUTTON, iButton, (LPARAM)lpData); ReadProcessMemory(hTrayProc, lpData, &buttonData, sizeof(TBBUTTON), &dwBytesRead); DWORD dwExtraData[2] = { 0,0 }; ReadProcessMemory(hTrayProc, (LPVOID)buttonData.dwData, dwExtraData, sizeof(dwExtraData), &dwBytesRead); HWND hWndOfIconOwner = (HWND) dwExtraData[0]; int iIconId = (int) dwExtraData[1]; if( !(buttonData.fsState & TBSTATE_HIDDEN) ) { HMENU hMenu = GetMenu(hWndOfIconOwner); } }
If you take a look at the last if statement, I check whether the current icon is showing, and if it is it gets the handle to the menu. I'm not too sure whether doing GetMenu is actually getting the handle of the same menu as when I right click on it.
Basically, if I right click on the icon, it pops up a menu, and there is a menu item with a submenu with a list of items which can be checked. All I want to do see which ones is checked.
Thanks for any response in advance.
noit
![]() |
Similar Threads
- Hello - No start menu, desktop, or system tray Please help (Windows NT / 2000 / XP)
- C#,system tray, wont go from task bar. (C#)
- Virus Alert Icon in System Tray HELP! (Viruses, Spyware and other Nasties)
- Rogue system tray icons and pop-ups. (Viruses, Spyware and other Nasties)
- Search assitant/Shopping Wizard Search Extender (Viruses, Spyware and other Nasties)
- System Tray Icons (Windows NT / 2000 / XP)
- Spyware problem (Viruses, Spyware and other Nasties)
- Hijackthis Log File Below - Please Help! (Viruses, Spyware and other Nasties)
- hijackthis.log - New User (hope i did it right) (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: Read encrypted file header
- Next Thread: Maya API
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy directshow dll download dynamic dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib library linkedlist linker list loop looping loops map math matrix memory microsoft newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg simple sorting string strings temperature template test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





