Jump to content

Help Create Context Menu Only Without GUI.


Go to solution Solved by funkey,

Recommended Posts

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
Posted

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

Posted

Use function WinList to get the handle of the window.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

  • Solution
Posted

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.

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...