Sign in to follow this  
Followers 0
ngskicker

Help Create Context Menu Only Without GUI.

7 posts in this topic

#1 ·  Posted (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.

Posted Image

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 by ngskicker

Share this post


Link to post
Share on other sites



Hi,

Take a look at the _GUICtrlMenu_TrackPopupMenu function.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Use function WinList to get the handle of the window.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
in the autoit help it says, "Handle to the window that owns the shortcut menu" i think ordinary window handle will not work.

Share this post


Link to post
Share on other sites

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 to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0