Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

SOLVED:Change right mouse menu

$
0
0

Welcome

How can I disable pressing the right button on the gui input or make it possible but with functions  paste only.

The paste option would be best.

AutoIt         
#include <GUIConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3>   Opt("GUICoordMode",2) Opt("GUIResizeMode", 1) Opt("GUIOnEventMode", 1)   $Parent1 = GUICreate("Program", 550, 260, -1, -1) ; width, height, position on screen from left       $Text= GUICtrlCreateLabel("Nazwa", 30, 20, 400, 20)     $name = GUICtrlCreateInput("", -400, 5, 300, 20)     GUISetOnEvent($GUI_EVENT_CLOSE, "Events") GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "Events")   GUISetState(@SW_SHOW)   While 1 Sleep(10) Wend   Func verPressed() Run("winver") EndFunc   While 1 Sleep(10) Wend           Func Events()   Select Case @GUI_CTRLID = $GUI_EVENT_CLOSE Exit   Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)   Case @GUI_CTRLID = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)   Case @GUI_CTRLID = $GUI_EVENT_SECONDARYDOWN MsgBox(64, "Click", "Right click not allowed")   EndSelect   EndFunc

I found this code and tried to add it to my code, but still I have errors.

AutoIt         
#include <GuiConstants.au3> #Include <Misc.au3> $Gui = GUICreate("Right Click Test", 400, 400)   ;- ///// Credit an Edit and Input box to show contextual menus for ////// $edit = GUICtrlCreateEdit("Test Information", 0, 0, 400, 200) $input = GUICtrlCreateInput("Test Input", 0, 220, 120, 25)   ;- //// Create a dummy Context Menu //////// $DummyMenu = GUICtrlCreateDummy() $ContextMenu = GUICtrlCreateContextMenu($DummyMenu) ;- //// Add the 'Disabled' item to the menu //////     GUICtrlCreateMenuItem("Disabled", $ContextMenu)   ;- //// Open the DLL responsible for keyclicks/controls/etc //// $dll = DllOpen("user32.dll")   GUISetState()   While 1       $Msg = GUIGetMsg()   ;- //// If the right 'menu' context key is pressed then show the disabled context menu ////     if _IsPressed("5D", $dll) Then             Context($Gui, $ContextMenu)     EndIf         Select         Case $Msg = $gui_event_close             DllClose($dll)             Exit   ;- //// If the Right Mouse Button is clicked, show the disabled context menu ////         Case $Msg = -9             Context($Gui, $ContextMenu)       EndSelect WEnd   ;- //// This is the context menu function to be able to show the menu //// Func Context($hWnd, $nContextID)     Local $hMenu = GUICtrlGetHandle($nContextID)   ;- /// Get current mouse position ////     $arPos = MouseGetPos()   ;- /// Break up mouse positions into variables ////     Local $x = $arPos[0]     Local $y = $arPos[1]   ;- //// Call the dll file opened above to show the custom context menu at the current mouse position ////     DllCall($dll, "int", "TrackPopupMenuEx", "hwnd", $hMenu, "int", 0, "int", $x, "int", $y, "hwnd", $hWnd, "ptr", 0) EndFunc   ;==>ShowMenu

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>