LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Labwindows/CVI application as windows XP service

How can I install my Labwindows/CVI application as Windows XP service ?
0 Kudos
Message 1 of 4
(5,017 Views)
The publisher Heise announced in their newest magazine of c't an artikel which describes exactly the method of how to run an application program as a service under Windows 2000 and XP.
Because of the fact that this can be done only by creating a new service and making some entries in the registry I recommend that you create an image of your harddrive or make a backup of your system and the registry keys and datas before trying out the following procedure which describes the way of how to run an application as a service under Windows XP:

1. copy the attached program srvany.exe (comes from MS NTResourceKit) into the Windows directory
2. run the attached batch file pad.bat (created by publisher Heise) with the following parameter from the command shell:
pad.bat
If the name or the path of your executable contains space characters, please remove them. If you need to pass optional parameters to your program at startup you can enter that under but this is optional.

Please notice that an application which is running as a service is not visible on your desktop after your login. If you want to make it visible you have to do the following:

1. open the control panel
2. doubleclick on performance and maintenance
3. doubleclick on administrative tools
4. doubleclick on services
5. select your installed service and select properties with a rightclick
6. switch to the Log On tab sheet and checkmark "Allow service to interact with desktop"
7. terminate and restart your service

If you need more informations on this please see the article "Unter falscher Flagge" in the c't magazine (#6 / 2004) from the publisher Heise or visit their homepage http://www.heise.de and ask them for a copy written in english of their article "Unter falscher Flagge".

BTW: I tryed that out on my Notebook running Windows XP professional with an .exe created by LabWindows/CVI 7.0 and it worked as described above.

Regards,
Heinrich Illig
Applications Engineering Manager
National Instruments
Download All
Message 2 of 4
(5,017 Views)

This is dated early 2004.  Is there any different way?

0 Kudos
Message 3 of 4
(4,510 Views)

I chose to go the route of brute forcing it.  I have an executible that accepts an install or uninstall option which then calls the appropriate functions to install itself or uninstall itself as a service .

 

To install as a service, you'll want to use the functions "OpenSCManager", "CreateService", "ChangeServiceConfig2" and "StartService".

 

For the uninstall, you'll need "OpenService" and "DeleteService"

 

You can google these functions and find examples of their usage.

 

In your main function, if there is no install/uninstall switch given, call "StartServiceCtrlDispatcher" to start your service

Message 4 of 4
(4,497 Views)