dushkin Posted July 8, 2013 Share Posted July 8, 2013 Hi all, I am working on an application which has a list view, and can open a context menu on each one of the list item. How can I get information about the menu? I managed to go through the menu items by sending "down" commands. But how can I check for example the items text? I tried this: $hMenu = _GUICtrlMenu_GetMenu($hListViewHandle) $itemtext =_GUICtrlMenu_GetItemText($hMenu, 1) ConsoleWrite("Menu item text: " & $itemtext & @CRLF) but $itemtext was empty. I think my problem is getting the menu handler, because I am familiar with the _GUICtrlMenu functuions. Thanks! Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted July 8, 2013 Moderators Solution Share Posted July 8, 2013 dushkin,Try this: #include <WindowsConstants.au3> #include "SendMessage.au3" #Include <GuiMenu.au3> Global $sCurr_Text While 1 If WinExists("[CLASS:#32768]") Then $hWnd = WinGetHandle("[CLASS:#32768]") $hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0) If _GUICtrlMenu_IsMenu($hMenu) Then $iCount = _GUICtrlMenu_GetItemCount($hMenu) For $j = 0 To $iCount - 1 If _GUICtrlMenu_GetItemHighlighted($hMenu, $j) Then $sText = _GUICtrlMenu_GetItemText($hMenu, $j) If $sText <> $sCurr_Text Then ConsoleWrite($sText & @CRLF) $sCurr_Text = $sText EndIf EndIf Next EndIf EndIf Sleep(10) WEndIt looks for a standard Windows popup and checks if it is a menu. It works perfectly on standard Windows context menus - let us hope that your ListView uses the API to produce its context menus. M23 pixelsearch 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dushkin Posted July 8, 2013 Author Share Posted July 8, 2013 Well Mel, your'e the greatest! Thanks!!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now