Syla Posted March 13 Posted March 13 Hi everybody, is there a way to listen from this kind of events ? i already tried with _IsPressed but it does not work at all.
Developers Jos Posted March 13 Developers Posted March 13 12 minutes ago, Syla said: _IsPressed but it does not work at all. So what did you try? Show us the code that isn't working, so we can help. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Syla Posted March 13 Author Posted March 13 The code is working when i do the combination on my keyboard, but not by sending it from the driver of my touchpad. So, i don't think so the problem is from my code.
Developers Jos Posted March 13 Developers Posted March 13 What about you give us the full picture now first, because it's much easier when we know the whole story first! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Syla Posted March 13 Author Posted March 13 Opt("MustDeclareVars", True) If @OSVersion <> "WIN_11" Then Exit MsgBox($MB_SYSTEMMODAL, "", "This script only runs on Win 11") #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_HiDpi=Y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If Not (@Compiled ) Then DllCall("User32.dll","bool","SetProcessDPIAware") Local $Dll = DllOpen("user32.dll") While 1 Sleep ( 50 ) If _IsPressed("11", $Dll) Then If _IsPressed("25", $Dll) Then ExitLoop EndIf EndIf WEnd DllClose($Dll)
Developers Jos Posted March 13 Developers Posted March 13 Ok... thanks for that part, but this part is still unclear: 18 minutes ago, Syla said: but not by sending it from the driver of my touchpad. So how exactly are you simulating this key combination from your touchpad? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Syla Posted March 13 Author Posted March 13 Sorry for my mistake, i think it's the driver who is doing this !
junkew Posted March 13 Posted March 13 https://www.autoitscript.com/wiki/Tutorial_GUIRegisterMsg FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Syla Posted March 13 Author Posted March 13 Thanks junkew but in my case, there is nothing to do with a gui… am i wrong ?
Nine Posted March 13 Posted March 13 (edited) Try to hook WH_KEYBOARD_LL with _WinAPI_SetWindowsHookEx (see help file, there is a nice example of it) ps. you can also take a look at my Debug Messages Monitor UDF (see my signature for a link to it) Edited March 13 by Nine “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
junkew Posted March 14 Posted March 14 https://learn.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues The whole windows system is based on messaging. Your swipedevice has a driver that if it nicely behaves transforms your guesture to a sendinput or sendmessage for a keyboardmessage ctrl and left. So you must know which messages the driver is sending and then you have to catche.hook them. An advanced topic where you probably have to read a lot. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Solution Nine Posted March 14 Solution Posted March 14 @junkew Sorry to disagree with you, but some messaging passes thru OutputDebugString API messages, not thru standard messages. I tested a lot with those uncacheable messages and this is the only way. Asking to GUIRegisterMsg is absolutely not the solution in his case. Probably the best solution for OP is to hook to WH_KEYBOARD_LL like I already suggested... “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
junkew Posted March 15 Posted March 15 @Nine saying the same but with different wording😀 for sure its in the area of lowlevel messaging and hooking. With the limiterd amount of information how the swipe driver is sending ctrl and left its hard to guess which messages to hook. Nine 1 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
junkew Posted March 15 Posted March 15 https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/wintouch/architectural-overview.md is having WM_TOUCH messages. Then it depends afterwards what the driver is doing if its a nice driver it uses sendinput for driving the keyboard and/or mouse. (which you then can hook with a keyboard hook) And not sure where MS is going with WinUI: https://learn.microsoft.com/en-us/uwp/api/windows.ui.input.preview.injection?view=winrt-26100 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Syla Posted March 17 Author Posted March 17 (edited) Thanks junkew and Nine, i will try all your solutions today and tell you back here. Edited March 17 by Syla
Syla Posted March 17 Author Posted March 17 expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> HotKeySet('{F3}', '_EXIT') Dim $hHook, $hFunc, $pFunc $hFunc = DllCallbackRegister('_KeyboardHook', 'long', 'int;wparam;lparam') $pFunc = DllCallbackGetPtr($hFunc) $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, $pFunc, _WinAPI_GetModuleHandle(0)) While 1 Sleep(15) WEnd Func _EXIT() Exit EndFunc Func OnAutoItExit() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hFunc) EndFunc Func _KeyboardHook($iCode, $iwParam, $ilParam) Local $tKHS = DllStructCreate($tagKBDLLHOOKSTRUCT, $ilParam) Local $vkCode, $iScanCode If $iCode > -1 Then $vkCode = DllStructGetData($tKHS, 'vkCode') Switch $vkCode blah blah blah EndSwitch EndIf Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam) EndFunc Func _keybd_event($bvkCode, $Flag) DllCall('user32.dll', 'int', 'keybd_event', 'byte', $bvkCode, 'byte', 0, 'uint', $Flag, 'ptr', 0) EndFunc; Thanks To you both ! It works like a charm 🙂
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