frank10 Posted February 21, 2020 Posted February 21, 2020 (edited) I tried both _ispressed and the MouseOnEvent UDF: both work on desktop or other windows clicks such as Scite or Thunderbird, but they fail with Browsers such as Edge or Chrome. For example, this with _Ispressed: #include "misc.au3" While 1 If _IsPressed(01) Then _OnSingleClick() WEnd Func _OnSingleClick() Do sleep(1) Until not _IsPressed(01) ConsoleWrite("pressed" & @CRLF) EndFunc when you (EDIT touch-)click on Chrome, nothing happens. How to solve? Edited February 21, 2020 by frank10
CYCho Posted February 21, 2020 Posted February 21, 2020 (edited) This works for me. #include <Misc.au3> $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("01", $hDLL) Then _OnSingleClick() Sleep(1) WEnd DLLClose($hDLL) Func _OnSingleClick() Do sleep(1) Until not _IsPressed("01", $hDLL) ConsoleWrite("pressed" & @CRLF) EndFunc Edit: I forgot to close $hDLL. Edited February 21, 2020 by CYCho zPlayer - A Small Audio and Video Player
frank10 Posted February 21, 2020 Author Posted February 21, 2020 (edited) Thank you CYCho, but it doesn't work well. EDIT If I touch-click on Chrome it does nothing. And also, if I single touch-click on Scite it does nothing, instead it works in Scite only if I double touch-click. Before, with my code above, on Scite it gets also the single touch-click on Scite... EDIT2: it is the Sleep(1) on While cycle: you must delete this if you want to get a single touch-click on Scite! BTW I'm using a Surface Pro 7 (w10 64bit) Edited February 21, 2020 by frank10
CYCho Posted February 21, 2020 Posted February 21, 2020 (edited) I'm using Windows 10 64bit desktop and it works fine. Maybe touch-click on Surface Pro has different key value. Please check if _IsPressed("01", $hDLL) returns True when you touch-click on Surface Pro. Edited February 21, 2020 by CYCho zPlayer - A Small Audio and Video Player
frank10 Posted February 21, 2020 Author Posted February 21, 2020 Yes, it returns "True" also on Touch.
CYCho Posted February 21, 2020 Posted February 21, 2020 (edited) I tested with my laptop and it works as expected. I'm sorry I can't help you with Surface Pro. Edit: My laptop is not a touch screen. I tested the code on touch pad. Edited February 21, 2020 by CYCho zPlayer - A Small Audio and Video Player
frank10 Posted February 21, 2020 Author Posted February 21, 2020 I tested also on a Lenovo Yoga 720 with touchscreen: It's the same.
Nine Posted February 21, 2020 Posted February 21, 2020 You may want to consider this approach, as it is more robust and in line with Microsoft Windows: https://docs.microsoft.com/fr-ca/windows/win32/api/winuser/nf-winuser-registertouchwindow “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
frank10 Posted February 21, 2020 Author Posted February 21, 2020 Ok Nine, so if I do: $hGUI = WinGetHandle("Chrome") DllCall("User32.dll", "BOOL", "RegisterTouchWindow", "HWND", $hGUI, "ULONG", 2) ;~ GUIRegisterMsg($WM_TOUCH, "WM_TOUCH") How do I register the msg to the Chrome Window, instead of the classic GUIRegisterMsg for the GUI window?
Nine Posted February 21, 2020 Posted February 21, 2020 Have you tested the return value ? Is it working or not ? I don't know if you can register a window that you do not own. You will have to experiment with it. I can't test it, I don't have a touch screen monitor here. “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
frank10 Posted February 21, 2020 Author Posted February 21, 2020 (edited) With the GUI Handle, the dllCall returns this array: [0] = 1 [1]= 0x001102DC [2]= 2 Trying to connect to Scite Handle Window, the dllCall returns this array: [0] = 0 [1]= 0x000F02DC [2]= 2 and @error = 0 on both call. So, yes DLLcall seems to be working having the array as a result, but the function RegisterTouchWindow returns 0 with a non-GUI win. Edited February 21, 2020 by frank10
frank10 Posted February 21, 2020 Author Posted February 21, 2020 (edited) In fact: " The function fails with ERROR_ACCESS_DENIED if the calling thread does not own the specified window. " So, if I can't associate to a window, how can I detect touch-clicks on browsers? Edited February 21, 2020 by frank10
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