iAmNewbe Posted August 8, 2019 Posted August 8, 2019 I wrote a little application to remote control a music player application with one of my multi-button mouses. Is there a way to prevent the right click menu from appearing but still allow the right click button to register? I also want to track the mouse wheel so I can control volume. Anyway to do that also? There was no mention in the manual about these two things, not sure if there is another way to go about this.
iAmNewbe Posted August 8, 2019 Author Posted August 8, 2019 I am not interested in SENDING these commands.. I want to track through something like _isPressed or some similar function to register physical mouse clicks, scroll wheel turn front or back and also the middle mouse click which that exists.
Nine Posted August 8, 2019 Posted August 8, 2019 Callback mouse function to track mouse usage... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
mikell Posted August 8, 2019 Posted August 8, 2019 (edited) Here it is expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> HotKeySet('{ESC}', '_Close') Global Const $tagMSLLHOOKSTRUCT = $tagPOINT & ';uint mouseData;uint flags;uint time;ulong_ptr dwExtraInfo;' Global $hFunc, $pFunc, $hHook, $hMod, $iCounter = 0 ; The wheel counter $hFunc = DllCallbackRegister('_MouseProc', 'lresult', 'int;int;int') $pFunc = DllCallbackGetPtr($hFunc) $hMod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pFunc, $hMod) While 1 Sleep(20) WEnd Func _MouseProc($iCode, $iwParam, $ilParam) Local $tMSLL, $iDelta If $iCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) $tMSLL = DllStructCreate($tagMSLLHOOKSTRUCT, $ilParam) Switch $iwParam Case $WM_RBUTTONUP ; right ckick ConsoleWrite("Right click" & @LF) ; <<<< some action here Return 1 ;<<<<<<< without further condition setting this disables right click everywhere (context menus etc) Case $WM_MBUTTONUP ; middle click ConsoleWrite("Middle button click" & @LF) Case $WM_MOUSEWHEEL ; mouse wheel $iDelta = BitShift(DllStructGetData($tMSLL, 'mouseData'), 16) If $iDelta < 0 Then $iCounter -= 1 Else $iCounter += 1 EndIf ConsoleWrite($iCounter & @LF) ; Return 1 ; <<<< ditto EndSwitch Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) EndFunc Func _Close() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hHook) Exit EndFunc Edited August 8, 2019 by mikell comments
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