Jump to content

Search the Community

Showing results for tags 'right click'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 5 results

  1. I had written a GUI with several buttons and I wanted one of the buttons to show its context menu regardless of the user right or left clicking the button. The whole purpose of the button was to show the user a menu of options and a context menu fit the need just fine, but I needed it to display with either click option. I came up with the code below to accomplish this but I feel like I might be missing some very obvious easier way to do this and I feel it's a little lame to be forcing a right click mouse action on the button as a result of the user doing a left click, but it works! Anyone have a suggestion of a better way to do this? Otherwise, if this idea helps you, here you go. #include <GUIConstantsEx.au3> LeftClickContextTest() Func LeftClickContextTest() Local $hGUI = GUICreate("My GUI", 200, 100) Local $button = GUICtrlCreateButton("Show Context", 15, 40, 85, 25) Local $close = GUICtrlCreateButton("Close", 110, 40, 85, 25) Local $context = GUICtrlCreateContextMenu($button) GUICtrlCreateMenuItem("Test Context Item 1", $context) GUICtrlCreateMenuItem("Test Context Item 2", $context) GUICtrlCreateMenuItem("Test Context Item 3", $context) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $close ExitLoop Case $button MouseClick("right", MouseGetPos(0), MouseGetPos(1), 1, 0) EndSwitch WEnd EndFunc
  2. It has been a while since I last installed and used Autoit, I just installed the latest version along with Scite. For some reason, I do not have the option to create new .au3 files when right clicking. I have tried rebooting, and running the installation as administrator as mentioned in other threads. no joy... OS = Windows 10 Enterprise version 1806 Thanks in advance!
  3. #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <WindowsConstants.au3> #include <GuiMenu.au3> Global $g_hTreeView Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo Example() Func Example() Local $hGUI, $hItem Local $iStyle = BitOR($TVS_EDITLABELS, $TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS, $TVS_CHECKBOXES) $hGUI = GUICreate("(UDF Created) TreeView Create", 400, 300) $g_hTreeView = _GUICtrlTreeView_Create($hGUI, 2, 2, 396, 268, $iStyle, $WS_EX_CLIENTEDGE) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") _GUICtrlTreeView_BeginUpdate($g_hTreeView) For $x = 1 To Random(2, 10, 1) $hItem = _GUICtrlTreeView_Add($g_hTreeView, 0, StringFormat("[%02d] New Item", $x)) For $y = 1 To Random(2, 10, 1) _GUICtrlTreeView_AddChild($g_hTreeView, $hItem, StringFormat("[%02d] New Child", $y)) Next Next _GUICtrlTreeView_EndUpdate($g_hTreeView) ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example Func WM_CONTEXTMENU($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam ;ConsoleWrite($GUI_RUNDEFMSG & @CRLF) ;Switch $wParam ; Case $hTreeView Local $hMenu $hMenu = _GUICtrlMenu_CreatePopup() _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, $wParam) _GUICtrlMenu_DestroyMenu($hMenu) Return True ;EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_CONTEXTMENU Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Switch $wParam Case $e_idOpen _DebugPrint("WM_COMMAND " & $wParam & " Open") Case $e_idSave _DebugPrint("WM_COMMAND " & $wParam & " Save") Case $e_idInfo _DebugPrint("WM_COMMAND " & $wParam & " Info") EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $g_hTreeView If Not IsHWnd($g_hTreeView) Then $hWndTreeview = GUICtrlGetHandle($g_hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK ; The user has clicked the left mouse button within the control _DebugPrint("$NM_CLICK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing Case $NM_DBLCLK ; The user has double-clicked the left mouse button within the control _DebugPrint("$NM_DBLCLK" & @CRLF & "--> hWndFrom:" & @TAB & $hWndFrom & @CRLF & _ "-->IDFrom:" & @TAB & $iIDFrom & @CRLF & _ "-->Code:" & @TAB & $iCode) ; Return 1 ; nonzero to not allow the default processing Return 0 ; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_Text, $sLine = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @CRLF & _ "+======================================================" & @CRLF & _ "-->Line(" & StringFormat("%04d", $sLine) & "):" & @TAB & $s_Text & @CRLF & _ "+======================================================" & @CRLF) EndFunc ;==>_DebugPrint In the example code I have a treeview and a context/popup menu, I can't use a conventional context menu because I need to use the treeview UDF functions. The WM_COMMAND never fires from the context/popup menu selection while there is a treeview using _GuiCtrlTreeview_Create If you comment out _GuiCtrlTreeview_Create line you will then see the right click selection works as expected and the debug is written to the console on selection. Autoit Ver 3.3.14.2 Any ideas why this combination won't work together? Thanks
  4. Mak Context Entry Creator +|=========================================|+ Mak Context Entry Creator is a small autoit compiled tool which allow user to create a executable shortcut at their desktop right click. The main purpose of this software is to make desktop clean and minimal. Majority of user link their useful shortcuts to their desktop and also at their taskbar. Desktop shortcut looks somewhat dirty so i created an app which let you to be minimal but also without compromising the favorite or useful shortcut. Mak Context Entry creator adds your favorite or useful software to your right click by creating a registry key. You can add as many shortcut you want but it takes some CPU memory too. So by using this software your desktop remain minimal, hide your desktop shortcut or remove them. Open your shortcut using right click. How to Use? The application itself open with administrator privilege. Click on Select Path button and choose your executable path. The first text field display the executable name as it is, so in same cases you have to edit the name. The second text-field display the executable path(don't edit it). After then click Create Context Menu. You can also use auto-built features, these are Add Registry, Add CP. Also included the Services.msc. The only drawback of this application is that you can not delete the registry value using this application, but you can use the registry editing tutorial given in the read me file. Also a backup file is also given. If you like this application please comment and share with your friend. And if you like to help me yo're welcome. This is my first application here and first GUI application i created. Mak Context Entry Creator v1.1.7z
  5. I found this example on an edit control: #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <GuiMenu.au3> #include <Constants.au3> #include <WinAPI.au3> Global Enum $idOpen = 1000, $idSave, $idInfo $hGUI = GUICreate("Test", 300, 200) $Edit1 = GUICtrlCreateEdit("", 10, 10, 280, 150, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE)) $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, "Open", $idOpen) _GUICtrlMenu_AddMenuItem($hMenu, "Save", $idSave) _GUICtrlMenu_AddMenuItem($hMenu, "Info", $idInfo) GUISetState() $wProcHandle = DllCallbackRegister("_WindowProc", "ptr", "hwnd;uint;wparam;lparam") $wProcOld = _WinAPI_SetWindowLong(GUICtrlGetHandle($Edit1), $GWL_WNDPROC, DllCallbackGetPtr($wProcHandle)) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGui) DllCallbackFree($wProcHandle) Func _WindowProc($hWnd, $Msg, $wParam, $lParam) Switch $hWnd Case GUICtrlGetHandle($Edit1) Switch $Msg Case $WM_CONTEXTMENU _GUICtrlMenu_TrackPopupMenu($hMenu, $wParam) Return 0 Case $WM_COMMAND Switch $wParam Case $idOpen ConsoleWrite("-> Open" & @LF) Case $idSave ConsoleWrite("-> Save" & @LF) Case $idInfo ConsoleWrite("-> Info" & @LF) EndSwitch EndSwitch EndSwitch Local $aRet = DllCall("user32.dll", "int", "CallWindowProc", "ptr", $wProcOld, _ "hwnd", $hWnd, "uint", $Msg, "wparam", $wParam, "lparam", $lParam) Return $aRet[0] EndFunc How could the above be done for a richedit control?
×
×
  • Create New...