Jump to content

Context menu


Krol
 Share

Recommended Posts

Something like this should start you off.

#include <GuiConstants.au3>

HotKeySet("{F2}", "Context")

$hwnd = GUICreate("", 400, 300)
GUISetState()

Do
    $Msg = GUIGetMsg()
Until $Msg = $GUI_EVENT_CLOSE

Func Context()
    Local $Pos = WinGetPos($hwnd)
    
    $C = GUICreate("", 60, 80, $Pos[2], $Pos[3])
    GUISetState()
    
    While WinExists($C)
        $cMsg = GUIGetMsg()
        Switch $cMsg
            Case $GUI_EVENT_CLOSE
                GUIDelete($C)
        EndSwitch
    WEnd
EndFunc

You will need to change the Context GUI style.

Link to comment
Share on other sites

made this awhile ago.. :)

#include <GUIConstants.au3>
Global $title="Customizedcontextmenu"
HotKeySet("{End}", "Terminate")
HotKeySet("{f1}", "RClickie")
GUICreate($title, 1, 1,1,1,$WS_POPUP)


$contextmenu    = GUICtrlCreateContextMenu ()

$newsubmenu  = GUICtrlCreateMenu ("new", $contextmenu)
$textitem      = GUICtrlCreateMenuitem ("text", $newsubmenu)

$fileitem      = GUICtrlCreateMenuitem ("Open", $contextmenu)
$saveitem      = GUICtrlCreateMenuitem ("Save", $contextmenu)
GUICtrlCreateMenuitem ("", $contextmenu)   ; separator

$notepad      = GUICtrlCreateMenuitem ("Notepad", $contextmenu)

GUISetState ()
WinSetState ($title, "",@SW_HIDE)

While 1
$msg = GUIGetMsg()
if $msg = $notepad then Run ( "notepad.exe")
    Sleep(10)
WEnd


Func Terminate()
    Exit 0
EndFunc

Func RClickie()
$pos = MouseGetPos()
WinMove ($title, "", $pos[0], $pos[1])
ControlClick ($title,"","","right")
WinSetState ($title, "",@SW_hide)
EndFunc
Link to comment
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
 Share

  • Recently Browsing   0 members

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