Azevedo Posted April 21, 2017 Share Posted April 21, 2017 (edited) In ahk it is possible to show a popup menu without a gui. Is it possible in AutoIt or it can only be triggered from a gui component? Edited April 21, 2017 by Azevedo Link to comment Share on other sites More sharing options...
InunoTaishou Posted April 22, 2017 Share Posted April 22, 2017 Popup menu, like right clicking the desktop? That menu? #include <GuiMenu.au3> #include <WindowsConstants.au3> Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo ; Fake gui, just used to show the popup menu Global $hGui = GUICreate("Popup") Global $hMenu = _GUICtrlMenu_CreatePopup() Global $aMousePos = MouseGetPos() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, $hGui, $aMousePos[0], $aMousePos[1]) GUIRegisterMsg($WM_COMMAND, WM_COMMAND) ; Handle WM_COMMAND messages Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $e_idOpen ConsoleWrite("Open" & @LF) Case $e_idSave ConsoleWrite("Save" & @LF) Case $e_idInfo ConsoleWrite("Info" & @LF) EndSwitch EndFunc ;==>WM_COMMAND There might be abetter way but this is how I figured it out. Never used a context menu by itself. Link to comment Share on other sites More sharing options...
Azevedo Posted April 22, 2017 Author Share Posted April 22, 2017 (edited) Exactly that! Thanks mate! Edited April 22, 2017 by Azevedo 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