EKY32 Posted August 18, 2012 Share Posted August 18, 2012 (edited) Can i run a command when the mouse wheel moves? Like using GuiCtrlSetOnEvent.. but detecting the mousewheel move. Thank you. Edited August 18, 2012 by EKY32 [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
JScript Posted August 18, 2012 Share Posted August 18, 2012 Yes, try this example: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _Example() ; _Example Func _Example() GUICreate("My GUI", 640, 480, 50, 50) ; will create a dialog box that when displayed is centered GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL") GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN Sleep(250) ToolTip("") WinClose("[CLASS:Notepad]", "") EndSwitch WEnd GUIDelete() EndFunc ;==>_Example Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) Local $iMPos = MouseGetPos() ToolTip("Mouse wheel is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Test", 1, 3) Run("Notepad.exe") Return $GUI_RUNDEFMSG EndFunc ;==>_WM_MOUSEWHEEL Regards, João Carlos. Xandy 1 http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
EKY32 Posted August 18, 2012 Author Share Posted August 18, 2012 Oh Mr.JScript, you are killing me with your kindness Thank you again very much, another flower to your score :] [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
Xandy Posted August 18, 2012 Share Posted August 18, 2012 (edited) Very useful demonstration. I am learning neat concepts from this design. Thank you JScript. I never knew this, $GUI_EVENT_PRIMARYDOWN Edited August 18, 2012 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
EKY32 Posted August 18, 2012 Author Share Posted August 18, 2012 Mr. JScript: Is it possible to know if the wheel is up or down? In fact i want to switch between tab controls with mouse wheel, so i need to detect if it's wheel up or down. Thank toy. [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
JScript Posted August 18, 2012 Share Posted August 18, 2012 (edited) Yes, in the same example with little modification: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> _Example() ; _Example Func _Example() GUICreate("My GUI", 640, 480, 50, 50) ; will create a dialog box that when displayed is centered GUIRegisterMsg($WM_MOUSEWHEEL, "_WM_MOUSEWHEEL") GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN Sleep(250) ToolTip("") EndSwitch WEnd GUIDelete() EndFunc ;==>_Example Func _WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) Local $iMPos = MouseGetPos() Switch $wParam Case 0x00780000 ToolTip("Mouse wheel UP is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Wheel UP", 1, 3) Case 0xFF880000 ToolTip("Mouse wheel Down is detected!" & @CRLF & @CRLF & 'Click in the "My GUI" to return...', $iMPos[0], $iMPos[1], "Wheel Down", 1, 3) EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_MOUSEWHEEL Regards, João Carlos. Edited August 18, 2012 by JScript Synapsee 1 http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
EKY32 Posted August 18, 2012 Author Share Posted August 18, 2012 Ah! you are really embarrassing me Thank you very much!! [font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now