Jump to content

Recommended Posts

Posted (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 by frank10
Posted (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 by CYCho
Posted (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 by frank10
Posted

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?

Posted
Posted (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 by frank10
Posted (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 by frank10

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...