Example Code

Convert LabVIEW application into Windows Service

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

You can convert any application (executable .exe) into windows service using the methods mentioned in https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019OcfSAE&l=en-US .  And,Sappster has done a good job of using Microsft Resource Toolkit to achieve it in https://forums.ni.com/t5/Example-Code/Install-Application-as-Windows-Service-in-LabVIEW/ta-p/3532699

 

In some cases you would find it's hard to install Microsoft Resource Toolkit (example of where you don't have proper windows authentication to install toolkit).  So do I.  Also, I needed more than just installing the service  i.e., START service, STOP service and REMOVE service.  Hence I have created a wrapper of modified Sappster's work to achieve such needs.  The VI in the attached zip file here makes use of only two executables from resource toolkit (instsrv.exe and srvany.exe) to convert any executable into windows service and enables to do

  1. Install any executable as windows service.
  2. Start the windows service
  3. Stop the windows service
  4. Remove the windows service which you installed
--
Ajay MV


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.