05-04-2016 07:04 AM
Is there a way, i can identify the windows services required for a proper run of my application?
(despite trail and error)
Background, we run an application at the costumer site pc. The application is set to start into autostart, as windows deterimes the order which services/apps starts first, i want to ensure, all services required for my application are already in the desired state. (No i dont want to put a batch with a simple wait function in front of my app or something simiular)
To get the status i use .NET in Labview - check the attached snippet.
I just need a list of the services, here is what hardware i use:
IMAQdx Camera (i guess some service need here)
Variable Engine (For shared variables i guess)
some unkown stuff
Any informations are highly appreciated, thanks in advance.
Cheers chris
05-04-2016 07:18 AM
05-04-2016 09:03 AM
Hi mike,
i want to check all the resources external or "internal" (LV services) my application needs to run. I can check these already, i use the corresponding .NET assembly for this purpose.
I just want to know how i can, lets say, populate a list of all resources (in this case windows services) i need for my application.
05-04-2016 05:42 PM
05-06-2016 12:10 AM
05-06-2016 07:05 AM
05-10-2016 07:54 AM - edited 05-10-2016 07:58 AM
In your question order....
Putting a delay between what?
The LV app, isnt in the autostart directly. The autostart includes a batch file. This batch file, starts and wait to end an c# app. This c# starts, waits 20s and shuts itself down. Afterwards the LV app is called from the batch file.
What does your program do?
It is an program for machine vision inspection. It includes IMAQdx camera implementation, also some external dll for communication to various PLC i.e. industrial ethernet, profibus etc...
What is your program trying to do when it hangs?
It is trying to initialize the cameras.
What errors are being generated that you aren't handling properly?
-1074360311
Now look, when we put this batch file in front of our applikation, on system startup, it is working fine. Also when you close the app, and start it again - no problems.
This happens only on system startup with the autostart without delaying the applikation start. This construct works fine for more than two years now on more than 20 lines.
Furthermore, the error gets handled, but i dont want to poll 100x for the error, because the error can be caused through a lack of ethernet connection too. Router down, pulled ethernet cable and
so on.
I have now the time to do some refactoring on the project, and this a side point i want to fix (if possible), or lets say to understand first....
So back to my original question: Is there a way - without trail and error - to find all services required for my applilkation. (as mentioned earlier - i can check the state, i just dont know which ones are required)
Cheers chris
05-11-2016 01:44 AM - edited 05-11-2016 01:53 AM
Are you aware that the batch command interpreter cmd.exe also supports wait functionality directly. Using a C# app for that sounds pretty heavyweight.
As to your searched information, rather than trying to determine specific services that might change with new driver releases and break your intended workaround, you should tackle this in your application directly. This kind of information is seldom documented since documenting it makes it much harder later on to change anything. And no unless you want to go into disassembly and system level debugging there is no good way to determine these dependencies other than by trial an error! IMAQdx needs all kinds of system level drivers and some of them are specific to your hardware, so NI couldn't even attempt to document what kernel drivers and services are all needed before IMAQdx can successfully open a camera interface.
I would rather try directly in LabVIEW to determine when the desired resource (here your camera) is available.
It's unclear what happens when you say it hangs. Are you trying to open the camera? You do get an error there, so what prevents you from waiting a few seconds when you receive this error and then try to open it again? Proper error handling in your code means sometimes to catch specific errors and do a retry or some alternative code path.
05-11-2016 02:34 AM
For the batch, sure, but this is the standard procedure from some old collegue, so why confuse the others...
Hm to summarize your statement, it would be very hard to find the service low lever drivers. Well thats what i was expecting after no short repsone to the topic. Guess i will just leave the delay in and put some ping all network connections first and then try to initialize the connections to the cameras....
Looks for me this isn worth the time.
So thanks everybody for your efforts..
Cheers