LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lvinput.dll does not work if .exe installed as a Windows service

Solved!
Go to solution

Hi!

 

We have some problems with lvinput.dll if it's used in .exe which is installed as Windows service (Win7SP1/Win10b1809).

Simple .exe with keyboard/mouse access works ok.

Same .exe with administrator rights works too.

When .exe is loaded as service during Windows startup it does not work.

First of all "Query Input Devices VI" cannot find mouse device at all.

Then "Initialize Keyboard VI" and "Acquire Input Data VI" return no errors, but gets always nothing.

Does any limitation of lvinput.dll usage exist ?

Is there any workaround of this issue ?

 

Thanks a lot!

0 Kudos
Message 1 of 5
(2,419 Views)

Windows service not suppose to have a user interface.

You will have to create a separate GUI for user input.

 

George Zou
0 Kudos
Message 2 of 5
(2,385 Views)

Just tried such scheme: main .exe as a service which calls second .exe with user input.
Actually I got same result(
Looks like "service" environment is very specific and even call second .exe does not help.

 

What kind of instruments are used under hood of "lvinput.dll" ?WinAPI events or DirectX or what ?

0 Kudos
Message 3 of 5
(2,344 Views)
Solution
Accepted by topic author Anton.S

A service works in a different session that has since Windows 7 no access to most UI subsystems in Windows. That includes screen and everything else (actually keyboard and mouse might have been inaccessible before since it simply doesn’t make sense for a service and even poses security risks).

If you start another exe from your service it executes in the same session with the same limitations. What Goerge meant is to create a separate exe that runs in the normal user session (when you are logged in) or one of the other. 3 possible workstation sessions (which are almost never used in Windows 😀) but equally require a logged in user. Then have them communicate with each other through TCP/IP or some other IPC (inter process communication) mechanism.

If you really want to create a piece of software that needs access to the hardware while nobody is logged in you won’t get around writing a Windows device driver and that can only be done in C(++).

Rolf Kalbermatter
My Blog
Message 4 of 5
(2,333 Views)

Thank you for the detailed explanation!

0 Kudos
Message 5 of 5
(2,297 Views)