LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call user32 GetTouchInputInfo for multitouch

Solved!
Go to solution

Hi everyone,

 

I'm trying to get some info about touch, I have a Acer T272HL.

At this moment, using Windows Message Queue.llb, I can intercept windows message WM_TOUCH from which I can read the current number of active touch point on the screen (low-order word of wParam).

Then I pass lParam, together with other arguments, to the GetTouchInputInfo function of user32.dll. This function takes a pointer to an array of TOUCHINPUT structures. So I set this argument of Call Library Function with Type="Adapt to Type" and Data Format="Array Data Pointer" and connect to this terminal an array of cluster of the type specified in the structure TOUCHINPUT. But when i call the node an error occurs.

Gettouchinputinfo.PNG

Can anyone help me?

Thanks

0 Kudos
Message 1 of 16
(5,145 Views)

What is your definition of the TOUCHINPUT cluster? The image does not show that!

 

And is this on LabVIEW 32 bit for Windows or 64 bit? The Windows message library is very old and won't do the right thing on LabVIEW 64 bit.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 16
(5,129 Views)

dwExtraInfo inside TOUCHINPUT should be a pointer.

Dll will return something I assume.

 

George Zou
0 Kudos
Message 3 of 16
(5,103 Views)

Hi rolfk and thank you for your answer. I'm using LV 2015 32-bit. The Windows message library is providing me correctly WM_TOUCH message.

I'm not absolutely sure about my definition of the cluster..


LONG x;-->I32
LONG y;-->I32
HANDLE hSource;-->I32 but HANDLE type is definied as PVOID and I don't know how to map into LV type..
DWORD dwID;-->U32
DWORD dwFlags;-->U32
DWORD dwMask;-->U32
DWORD dwTime;-->U32
ULONG_PTR dwExtraInfo;-->U32
DWORD cxContact;-->U32
DWORD cyContact;-->U32
} TOUCHINPUT, *PTOUCHINPUT;

 

I attach the VI I'm working on

0 Kudos
Message 4 of 16
(5,087 Views)

Hi zou. Mmm I don't know how can I do that during the definition of the cluster..

Yes dll should return the pointed array of TOUCHINPUT populated by the attributes of the current touch coordinates.

Thanks for your advice!

0 Kudos
Message 5 of 16
(5,077 Views)

 


@3vi87 wrote:

Hi zou. Mmm I don't know how can I do that during the definition of the cluster..

Yes dll should return the pointed array of TOUCHINPUT populated by the attributes of the current touch coordinates.

Thanks for your advice!


You can't easily! for now you can treat it as an U32 if you work on 32 bit LabVIEW. Same about the HANDLE

 

From what I can see the structure definition as described in your post seems to match with the datatypes. So not really sure where it goes wrong. Not having a touch device I can't test it myself either. Does the length of the flattened cluster return 40?

 

 

 

OOps! MSDN has to say this about the first parameter to the GetTouchInputInfo() function:

 

The touch input handle received in the LPARAM of a touch message. The function fails withERROR_INVALID_HANDLE if this handle is not valid. Note that the handle is not valid after it has been used in a successful call to CloseTouchInputHandle or after it has been passed to DefWindowProc, PostMessage, SendMessage or one of their variants.

 

Unfortunately at the time the event arrives in your event handling structure, LabVIEW has passed the event already to DefWindowProc() internally so the handle is not anymore valid. It would seem that there is no other way than to dig into C programming and write your own message hook library that handles the event in the C code and retrieves the information before sending it of to DefWindowProc() itself and then uses PostLVUserEvent() or similar C API to send the result to the event structure. But beware this is advanced C programming!

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 16
(5,071 Views)

Ok so the cluster definition should be correct and yes the length of the flattened cluster return 40.

Arrgh it seems more difficult than expected..

Since I'm not very comfortable in C programming, Is there an easy way to edit Windows Message Queue.llb in order to act as you described in your previous post?

0 Kudos
Message 7 of 16
(5,040 Views)
Solution
Accepted by topic author 3vi87

No, unfortunately not. You have to go into the C code for that DLL and make substantial modifications to it.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 16
(5,035 Views)

Finally I managed to create a dll in C# that can handle an event recalled by a callback from LabVIEW. It gives me back an array containing the coordinates of the points. Thank you all for the help.

0 Kudos
Message 9 of 16
(4,962 Views)

Hello,

I want to do the same thing as you did, tring to get the gesture message from windows to manipulate labview objects but I don't know how? Could you tell me more about your solution? Do you have the exact type of movement from windows (span, rotate, zoom,...)?

Is it easy to create a C# library, I don't have any skill in C and C#...

Thank you for your help!

Have a good day!

0 Kudos
Message 10 of 16
(4,426 Views)