LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GUI for win10 tablet

I am making GUI for win 10 tablet but I am working on win 7 PC. I need this GUI to have buttons with mechanical action switch until release. Problem is that tablet touchscreen does not detect touch until I move my finger on it or until I release touch. For this reason I can't use events like mouse down or mouse enter.

I'd like to avoid buying Touchscreen Toolkit because I need only one simple function.

I have found solution (attachement) with user32.dll and Windows Message Queue.llb  which I build and tested on win 7 PC (works fine) and win 10 tablet.  When I run it on win 10 although there aren't any errors it doesn't get any windows messeges (it doesn't work).

Do you have any idea why I can't transfer it to windows 10 and how to solve this problem?

 

Thanks in advance for help.

 

0 Kudos
Message 1 of 6
(3,169 Views)

Four or five years ago, I worked with a student to design a behavioral task for subjects with Parkington's Disease (it involved pointing or not pointing to illuminated targets).  We implemented this on a Win XP machine in LabVIEW 2011, using a Touch Panel "overlay" to a 15" monitor that acted just like a mouse.  Then the student "got cute" and bought one of the new All-In-Ones with a TouchScreen and Windows 7.  Oops, now "touch" is not the same as Mouse Down/Mouse Up!

 

The problem turned out to be how the Operating System interacted with the Screen to "fake" mouse clicks (you distinguish "Left Click" from "Right Click" by how long you "Mouse-down", as I recall).  We did complain to NI, but it was as much the Touch implementation and how Windows handled it ...

 

Bob Schor

0 Kudos
Message 2 of 6
(3,157 Views)

I found out that Windows Message Queue.llb  is working on win 10 but the messages are interpreted in the other way:

On the windows 7 I can receive message 0x0240 (WM_Touch) and it return the position of "touch" in the moment I press the screen. In windows 10 I always receive previous position of touch.  For example if I first  press (100px,100px) and than (200px,200px) the last message which I will receive will be (100px,100px) not (200px, 200px).

In addition in Win 10 I can't receive 0x0240 (WM_Touch) message but the 0x0246 (WM_POINTERDOWN) or 0x0245 ( I can't find the message name).
Does anybody know what am I doing wrong?

0 Kudos
Message 3 of 6
(3,054 Views)

I think this is a Microsoft question, as they have designed the Touch interface.  This was certainly the case several years ago with (I think it was) XP ...

 

Bob Schor

0 Kudos
Message 4 of 6
(3,047 Views)

0x0245

WM_POINTERUPDATE

 

Posted to provide an update on a pointer that made contact over the client area of a window or on a hovering uncaptured pointer over the client area of a window. While the pointer is hovering, the message targets whichever window the pointer happens to be over. While the pointer is in contact with the surface, the pointer is implicitly captured to the window over which the pointer made contact and that window continues to receive input for the pointer until it breaks contact.

 

Basically there are various trouble with the Pointer Device as implemented in modern Windows applications. Normal Windows apps including LabVIEW should not be concerned about this interface at all. Windows will then translate the messages to WM_MOUSEDOWN and friends messages instead, which LabVIEW and most other applications really will use. But those messages may be sent directly to the target window over which the event occurred and that is not the callback that is installed by the Windows message queue library.

 

Windows message hooks come in various flavors, one of them is hooking a specific window procedure, another one is hooking the main message loop procedure. Typically device messages such as from the pointer device get sent to the main message loop and may then be sent down the windows chanin to each individual window until one of them tells Windows that it handled it and doesn't want it sent to other windows in the chain. Other messages such as mouse events are only sent to the window over which the actual event occurred and if that window didn't handle it to its parent and so on.

 

All this makes windows message hooking a very complicated and non-user friendly business. For you it is important to know that the Windows message queue library does hook the main windows message loop in LabVIEW and not an individual windows procedure. Which messages get sent to which type of message hook, in which order and such, is tricky to know, kind of undocumented and can even change between Windows versions, which is why it is not such a good idea to try to process such low level events and even less to try to hook into them.

 

One other interesting tidbit on the MSDN page about these event messages is that they work in real DPI resolution and therefore only match with applications which are DPI aware. LabVIEW as a classic app is not DPI aware and doesn't announce to Windows through a manifest that it is, so Windows will virtualize the DPI settings for LabVIEW in its various high level messages such as WM_MOUSE.... etc, but that virtualization is not applied to WM_POINTER.... messages and therefore the coordinates may seem off from the ones LabVIEW works with.

Rolf Kalbermatter
My Blog
Message 5 of 6
(3,029 Views)

Thank you for answering. I didn't manage to make it in LabVIEW. I made with my colegue app in C# that is getting the windows events and sending cords via TCP to LabVIEW app :D.

0 Kudos
Message 6 of 6
(2,942 Views)