QingZi Posted January 18, 2010 Share Posted January 18, 2010 hi guys, i am trying to obtain the list of items in my windows context menu. i have done extensive research on windows api calls and the closest i got was http://www.autoitscript.com/forum/index.php?showtopic=33677&st=15. however the code is already outdated. can anyone point me in the right direction? i tried looking at _winapi_enumwindowspopup but the sample script doesn't seem to work. Link to comment Share on other sites More sharing options...
rajeshontheweb Posted January 18, 2010 Share Posted January 18, 2010 god i lost something valuable, i had a routine which collects all the right click menu verbs / items i will find out and get back here... Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
QingZi Posted January 18, 2010 Author Share Posted January 18, 2010 thanks. i am really at my wits ends. i even tried doing searches on registry only to find out disappointingly that they are all over the place and it is different for every pc. no one seem to ask this question here before too so couldn't find any usable sample codings to tweak and modify Link to comment Share on other sites More sharing options...
QingZi Posted January 19, 2010 Author Share Posted January 19, 2010 any ideas anyone? Link to comment Share on other sites More sharing options...
QingZi Posted January 20, 2010 Author Share Posted January 20, 2010 bumpz.. Link to comment Share on other sites More sharing options...
QingZi Posted January 22, 2010 Author Share Posted January 22, 2010 bumpz.. Link to comment Share on other sites More sharing options...
QingZi Posted February 8, 2010 Author Share Posted February 8, 2010 bumpz.. Link to comment Share on other sites More sharing options...
UritOR Posted September 14, 2015 Share Posted September 14, 2015 Well, now I got stuck on the same thing =( Can anyone help me? Link to comment Share on other sites More sharing options...
MilesAhead Posted September 14, 2015 Share Posted September 14, 2015 (edited) The static items that will load in the Context Menu are in the Registry. For dynamic items Windows has 3 COM interfaces, IContextMenu, IContextMenu2, IContextMenu3. You do not know what the COM dll or ocx is going to add to the menu until it responds to the QueryContextMenuBasically it is a nightmare.Edit: My comment refers to Explorer Context Menu. Regular context menus in applications are another matter. Someone on another forum is trying to figure out how to filter dynamic Explorer Context Menu items so I made that connection. My bad. Edited September 15, 2015 by MilesAhead clarification My Freeware Page Link to comment Share on other sites More sharing options...
LarsJ Posted September 15, 2015 Share Posted September 15, 2015 (edited) If it's a standard #32768 class context menu it's pretty easy:expandcollapse popup#include <GuiMenu.au3> #include <SendMessage.au3> #include <WindowsConstants.au3> Opt( "MustDeclareVars", 1 ) Example() Func Example() Local Static $hLastMenu = 0 HotKeySet( "{ESC}", "Quit" ) While Sleep( 100 ) Local $hDesktop = _WinAPI_GetDesktopWindow(), $hMenu = 0 Local $hChild = _WinAPI_GetWindow( $hDesktop, $GW_CHILD ), $i = 0 While $hChild And $i < 5 If _WinAPI_GetClassName( $hChild ) = "#32768" Then $hMenu = _SendMessage( $hChild, $MN_GETHMENU ) ExitLoop EndIf $hChild = _WinAPI_GetWindow( $hChild, $GW_HWNDNEXT ) $i += 1 WEnd If $hMenu And $hLastMenu <> $hMenu Then Local $iCount = _GUICtrlMenu_GetItemCount( $hMenu ), $sText ConsoleWrite( "Menu:" & @CRLF ) For $i = 0 To $iCount - 1 $sText = _GUICtrlMenu_GetItemText( $hMenu, $i ) If $sText <> "" Then ConsoleWrite( " " & $sText & @CRLF ) Next ConsoleWrite( @CRLF ) $hLastMenu = $hMenu EndIf WEnd EndFunc Func Quit() Exit EndFunc1. Run the script in SciTE2. Open the context menu3. Names of menu items should be printed in console4. Esc to exit script Edited September 15, 2015 by LarsJ Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions 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