06-02-2009 07:39 AM
Hello,
I'm using a USB-6501 module and it works fine when I use it in a Windows Desktop Application. When I modify it to run in a Windows Console, it also runs fine.
But when I put the same code of the console application in a Windows Service, the communication won't work. I'm not receiving any exceptions (errors) either.
Is there already something known about this issue?
I'm programming in VB.NET 2008 on a Windows XP Pro platform.
06-03-2009 04:59 AM
Hi
I found the following related to NT services, it's quite old and might differ a bit from the current way a windows service work but I suspect this might be related to your problem:
This transformation is actually a two-step process, the first of which is the
actual conversion of your program, which should be in the form of an executable
at this point, into an NT service. This is usually done through the use of
another program (SRVNY.EXE) that is a part of the NT resources kit.
The
second, more difficult step involves ensuring that your newly-created NT service
will load after the NI-DAQ kernel service is loaded. This can be accomplished by
making sure that the libraries from the DLL are loaded after the NI-DAQ kernel
is loaded.
The most common error encountered in this process is a "cannot
open DLL" error. Two things that you may consider in an attempt to avoid
encountering this error:
1. Load NDAQ32.DLL dynamically. By using a load
library function following a delay, you will give some time for the NI-DAQ
service to load.
2. Modify your service key in the Windows NT registry and
make it dependent upon the NIDAQ32k service. By doing this, you will force it to
wait long enough for the NI-DAQ kernel to be loaded.
In your registry,
edit the following key: HKEY_LOCAL_MACHINE » SYSTEM » CurrentControlSet »
Services. The NT service that you just created should be listed here, along with
Nidaq32k service. In order to make your service dependent upon Nidaq32k, add
this line to your service key: "DependOnService: REG_MULTI_SZ: Nidaq32k". This
should make your service wait for NI-DAQ.
06-03-2009 05:07 AM
First of all, thanks for the quick reply.
I will try this next week (out of office) and let you know the results.
regards
Dudeke
06-09-2009 07:48 AM
I tried do load the dll dynamically and did some modifications.
Now it is working just fine.
Thanks for the reply.
Greetz
Dudeke