The code below is taken from AZJIO from http://www.autoitscript.com/forum/topic/119804-volume-control Sense the Topic was over 3 years old, i felt i should make a new topic to ask my question.
The code allows a user to control the volume control by simily scrolling up and down with his mouse. An extremely cool idea (with some nice visuals i might add) though it is a little problematic as the scrolling itself is not blocked. So you end up at the bottom of a page when you just wanted to turn the volume down.
#include <GUIConstantsEx.au3> Const $WH_MOUSE = 7 Const $WM_AUTOITMOUSEWHEELUP = 0x1400 + 0x0D30 Const $WM_AUTOITMOUSEWHEELDOWN = 0x1400 + 0x0D31 Global $tr = 0, $setico='', $TrGui=0, $iniTrn, $iniX, $iniY, $iniAtSt, $iniDV, $iniColBk, $iniColVol, $a, $iniHK='', $iniHKM='' $gui = GUICreate("", 30, 135, 0, 0) Global $DLLinst = DllCall("kernel32.dll", "hwnd", "LoadLibrary", "str", ".\hook.dll") Global $mouseHOOKproc = DllCall("kernel32.dll", "hwnd", "GetProcAddress", "hwnd", $DLLinst[0], "str", "MouseProc") Global $hhMouse = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE, "hwnd", $mouseHOOKproc[0], "hwnd", $DLLinst[0], "int", 0) DllCall(".\hook.dll", "int", "SetValuesMouse", "hwnd", $gui, "hwnd", $hhMouse[0]) GUIRegisterMsg($WM_AUTOITMOUSEWHEELUP, "myfunc") GUIRegisterMsg($WM_AUTOITMOUSEWHEELDOWN, "myfunc") While sleep(500) WEnd Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam) ConsoleWrite("A") EndFunc
hook.rar 1.34KB
1 downloads
Code above, along with the dll, is what i found is needed for seeing if the scroll wheel has been used.
So does anyone know a way i could use this code but also block the scrolling when its detected?
Ian
*Extra
I am aware i could do the same thing with a _API_WindowsSetHookEx but i found using this type of hook makes the mouse laggy. I thought it was just me being weird but after doing some research online it seams that's not the case.