ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

current directory problem

Solved!
Go to solution
Hi there.
How can I force LabVIEW to go to a specific directory on the hard-drive? I have a DLL function which loads some .exe files into a DSP, but if (for example) a different directory had been previously specified by the file dialog then the DLL function fails (to locate the .exe files). I have tried all sorts of combinations of getting the current vi path etc, running an arbitrary batch file in the directory i want etc. None of this seems to work. The DLL (which I cannot edit) looks in the same directory for the .exe files.

pls help!
thanks
neil
Message 1 of 3
(2,827 Views)
Solution
Accepted by topic author Neil.Pate
Are you passing a path to the DLL or is the DLL looking for files in the current directory? If you need to set the current directory, a call to SetCurrentDirectoryA in kernel32.dll might do the trick. I've attached an example in LabVIEW 7.0 to show what I mean. It has a path constant that you can set to whatever you want.
Message 2 of 3
(2,827 Views)
Dennis,

the DLL is looking in the current directory, but
using the kernel32 function worked perfectly! 🙂

thanks a lot!
Message 3 of 3
(2,827 Views)