LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI simulate input drivers

I need to use LabVIEW to process data from an input device, but then I need to get the output from LabVIEW into Windows (eg, like x and y mouse coordinates). Does this mean I need LabVIEW to communicate with a "dummy" mouse driver or is there a more convenient solution?
0 Kudos
Message 1 of 7
(3,410 Views)
LabVIEW has built-in functions for getting data from input devices, like mice. However, I don't quite understand what you mean by "need to get the output from LabVIEW into Windows". Can you provide details on what you mean by this?
0 Kudos
Message 2 of 7
(3,401 Views)
I need LabVIEW to emulate mouse events in Windows, just as if it were acting as a mouse driver. I don't know at which level it should do this at, can LabVIEW emulate a kernel mode driver? Or would it be better to just send messages to Windows about mouse events?
0 Kudos
Message 3 of 7
(3,390 Views)
You can call the Windows API functions "SendMessage", "PostMessage", or "SendInput" (an older function) to send messages to Windows, such as a mouse move. You should also take a look at this KB article. Also note that the convention call to use should be set to "stdcall (WINAPI)" in the configuration window for the Call Library Function.
0 Kudos
Message 4 of 7
(3,383 Views)
I'm interested in doing the same thing. What KB article are you referencing? There is no link. Thanks.
0 Kudos
Message 5 of 7
(3,323 Views)
0 Kudos
Message 6 of 7
(3,318 Views)
I don't really like the way LabVIEW handles a lot of the structures used by the Windows kernel, so I wrote a wrapper DLL that simplifies the intialization and outputs.
Essentially:

26 WINAPISENDINPUT_API int fnWinAPISendInput(long x, long y, DWORD flags)
27 {
28         UINT cInputs = 1;
29
30         MOUSEINPUT mouseInput =
31         {
32                 x,      // LONG dx
33                 y,      // LONG dy
34                 0,      // DWORD mouseData
35                 flags, // DWORD dwFlags
36                 0,      // DWORD time
37                 0       // ULONG_PTR dwExtraInfo
38         };
39         INPUT input =
40         {
41                 INPUT_MOUSE,    // DWORD type
42                 mouseInput              // MOUSEINPUT mi
43         };
44         LPINPUT pInputs = &input;
45         return SendInput(cInputs, pInputs, sizeof(input));
46 }

0 Kudos
Message 7 of 7
(3,307 Views)