hi dears, i have a question please
am now working for an audio player for the blind users
and i added an option to open a file from the right click context menu.
but here there is a small problem, i hope that you can help me to find a solution for it.
the problem is as follow :
when i added the problem into the context menu it work with successfuly if the user select just one file.
but if the user selected more then one file, here the problem
a multiple sections of the program will open.
my question is :
how i can detect the multiple selection from the context menu?
i know that it so hard, but i know also that you are harder than it
for that dears please try to give me an solution for that problem.
thanks in advance
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
#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 188.8.131.52
Any ideas why this combination won't work together?
This is more of a practical question rather than a "I need help with my script" question...
There are going to be scenarios I will hit where I will need to scroll a web page to the left or the right rather than up or down. Can the MouseWheel function handle this or is there no known method to do this type of scrolling?
I know that if I control the mouse manually ( not via Autoit ) I can hit the middle mouse button which gives me a four arrow cursor and when I move the cursor left right up or down it begins scrolling in the relative direction I moved in with a speed relative to the distance I move from the point at which I clicked the middle mouse button. This is why I was wondering if the MouseWheel function had this ability.
Thanks for your thoughts and advice!
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