ngskicker Posted April 15, 2013 Share Posted April 15, 2013 (edited) Well, basically what I want is when I click on a window, I want to make it as if to bring up the context menu, which I still do not know how to do is how to make my script directly bring up the context menu when executed, i will explain what i mean.this window when clicked will open some program based on my setting,note, this picture only sample, the actual window does not created using autoit,when i click this window i want to run program that replicate context menu, and i don't want to always run autoit script to monitor my window. Edited April 15, 2013 by ngskicker Link to comment Share on other sites More sharing options...
FireFox Posted April 15, 2013 Share Posted April 15, 2013 Hi, Take a look at the _GUICtrlMenu_TrackPopupMenu function. Br, FireFox. Link to comment Share on other sites More sharing options...
ngskicker Posted April 15, 2013 Author Share Posted April 15, 2013 But how to get "Handle to the window that owns the shortcut menu" as i don't own the window, I think I'll explain it more clearly, first post updated Link to comment Share on other sites More sharing options...
water Posted April 15, 2013 Share Posted April 15, 2013 Use function WinList to get the handle of the window. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki  Link to comment Share on other sites More sharing options...
ngskicker Posted April 15, 2013 Author Share Posted April 15, 2013 in the autoit help it says, "Handle to the window that owns the shortcut menu" i think ordinary window handle will not work. Link to comment Share on other sites More sharing options...
Solution funkey Posted April 16, 2013 Solution Share Posted April 16, 2013 You can use the AutoIt window #include <GuiMenu.au3> Global Enum $idOpen = 1000, $idSave, $idInfo Global $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, WinGetHandle(AutoItWinGetTitle())) _GUICtrlMenu_DestroyMenu($hMenu) Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
ngskicker Posted April 16, 2013 Author Share Posted April 16, 2013 You can use the AutoIt window #include <GuiMenu.au3> Global Enum $idOpen = 1000, $idSave, $idInfo Global $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $idOpen) _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $idSave) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0) _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $idInfo) _GUICtrlMenu_TrackPopupMenu($hMenu, WinGetHandle(AutoItWinGetTitle())) _GUICtrlMenu_DestroyMenu($hMenu) Perfectly what i want, thanks funkey, SOLVED 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