Jump to content

Differentiate between Mouseclick and Touch-Click


Recommended Posts

Hello there :)

Is there a way to differentiate between a Mouseclick and a Touch-Click?

I've come across this msdn article here: https://msdn.microsoft.com/en-us/library/windows/desktop/hh454892(v=vs.85).aspx
which states a method to detect if the click has been made by mouse, finger or pen. Well .. at least this is what I think it does .. :D

There's also a question on stackoverflow about this topic: http://stackoverflow.com/questions/14297322/how-to-detect-tapping-touch-input-globally-instead-of-mouse-clicking

I want to know if my control has been clicked by mouse or by finger, to differentiate the behaviour of the script.

What I got by now is that you can do this by monitoring the mouse with GUIGetCursorInfo()
If the control has been clicked (GuiGetMsg) and GUIGetCursorInfo() on index 2 equals 0 then the control was clicked by touch.

But monitoring the Cursor like this needs to much of performance, especially when you have a whole bunch of GUIs at the same time ..
Even using GUIGetCursorInfo like this needs to much performance: GUIGetCursorInfo(WinActive(""))


So I just want to differentiate the clicks on another way. Can you help me with that? :) 

Thanks a lot!

Link to comment
Share on other sites

No. As I said I want my script to react differently on a Touch-Click than on a Mouse-Click. Thats all.

The thing is that you can't click a control with touch for a longer time period (without dragging it). So there can't be any _isPressed("01") for a longer time period. Therefore PNG-Buttons can't be created correctly. A Button can be pressed and the cursor can be moved to a different location which is not the button while the mouse button is beeing pressed. The button will start the action when the mouse button is released on not when it is pressed.
I think everybody has noticed this before ..
It is possible to mimic this with PNG-Buttons. But just for a Mouse-Click, not a touch-click.

I don't know if you understand what I am trying to explain, but thats not so important. Important is that I want to achieve this and that I am looking for a solution by differentiating between a Touch-Input and a Mouse-Input.

Unfortunately the WM_TOUCH message won't be send when you are touching a control. This would have been the easyest way .. :(

Any ideas? :)

Link to comment
Share on other sites

Ok I found a way to determine touch clicks into the GUI. You can register this message I found at msdn:


This works for controls too. Unfortunately only on Windows 8 and above ..
Does anybody know a solution that will work for Windows 7 (and maybe Vista, but that's not so important ..)? :)

Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...