LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

running labview program as system service

I was wondering if anyone has done this before.  I need a compiled Labview program to start up as a system service with windows XP. I'm using Labview 8.6.1. How do I do it? Thanks!
0 Kudos
Message 1 of 8
(4,343 Views)
Highlighted

Did you look at:   http://forums.ni.com/ni/board/message?board.id=170&message.id=291730&query.id=133124#M291730

 

or

 

http://digital.ni.com/public.nsf/allkb/21BA0F671A63A60386256CB4004DF99B?OpenDocument 

 



"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 2 of 8
(4,337 Views)

Also take a look here:

 

http://zone.ni.com/devzone/cda/tut/p/id/3185

 

We are currently deploying applications as XP services using this approach.  Works very well.

 

Note that if you intend for the program to interact with the desktop  ('Allow service to interact with desktop' in services.msc) you

may have difficulty with other OSs, specifically 2003/2008 Server.  Also, depending on the security environment, logging out a

user, even on XP, will cause the UI to break.  Easy work around, and probably better architecture to begin with, is to plan for

any UI to go through a web browser to a web exported front panel.

 

Matt

Message 3 of 8
(4,330 Views)

I took a look at http://members.cox.net/kuanchen/lvservice/index.html for creating a Windows NT Service but I dont know how to accomplish step 2.

 

"Link AnyService.dll to the LabVIEW dll created in Step 1"

 

I downloaded Visual C++ 2008 Express Edition to build dll, but how can I do that?

 

Julio Díaz
0 Kudos
Message 4 of 8
(4,202 Views)
I don't quite understand the question. Are you asking how to create a DLL? If so, then that information would be in the Visual C++ documentation. It should contain example projects, including one to build a DLL.
0 Kudos
Message 5 of 8
(4,181 Views)

Sorry, I think I wasn't clear in my last post.

 

I'm developing a program in LabVIEW that run continuosly without user interface, so I want to convert this program to a windows service. I took a look at http://zone.ni.com/devzone/cda/tut/p/id/3185 but I think this method does not provide a gracefully stop. Instead, I'm trying to follow the Kuan Chen's method, about to "create a Windows Service with LabVIEW" (http://members.cox.net/kuanchen/lvservice/index.html).

 

At the end of step 1 says "Build all the server code into a DLL". I did this: creating a "Shared Library" in "Build Specifications" Project Manager menu on LabVIEW. This procedure create a dll (LabVIEW.dll) with 2 functions BeginService and EndService.

 

In Step 2 Chen says "...Link AnyService.dll to the LabVIEW dll created in Step 1. Be sure to also link to labview.lib as it is very likely the LabVIEW DLL will use it.". I think it means link a dll to dll (AnyService.dll to LabVIEW.dll). Where do I do that? Is It posible link AnyService.dll to LabVIEW.dll in LabVIEW? or, Do I need do it from Visual C++?. And How to link labview.lib?

 

I know that if the "link dll to dll" procedure must be done in Visual C++, then I've been searching in the wrong forum, so let me know.

0 Kudos
Message 6 of 8
(4,137 Views)

Try looking at Explicit Runtime Linking and Using explicit runtime linking. If you need more help I'd also take a look at Walkthrough: Creating and Using a Dynamic Link Library on MSDN

 

It looks like you have to add some code to the AnyService.dll in order to link the Labview dll and lib as external resources. 

Misha
0 Kudos
Message 7 of 8
(4,131 Views)

juliodiaz wrote:

In Step 2 Chen says "...Link AnyService.dll to the LabVIEW dll created in Step 1. Be sure to also link to labview.lib as it is very likely the LabVIEW DLL will use it.". I think it means link a dll to dll (AnyService.dll to LabVIEW.dll). Where do I do that? Is It posible link AnyService.dll to LabVIEW.dll in LabVIEW? or, Do I need do it from Visual C++?. And How to link labview.lib?


I haven't used that procedure, but based on looking over it, then yes, that's what it means. When you build AnyService.dll you have to link in the LabVIEW DLL that contains the BeginService and EndService exported functions. This is done in the Visual C environment. The TestLVService VI simply calls the DispatchService function in AnyService.dll, so it assumes that the LabVIEW DLL has already been linked in. The executable of TestLVService.VI is what gets turned into a service using sc create. 

0 Kudos
Message 8 of 8
(4,128 Views)