LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Two questions about ini files and working directory.

1. How can I define the working directory of my application?

Generally after installing a CVI application the working directory of the link in the start menu is set to "." .
Is there a way to set it to e.g. "c:\programme\applicationdir\application.exe" automatically?
(I don't want to use SetDir(ProjectDir) in my code.)

2. Problems with Ini_GetRawStringIntoBuffer function and "." as working directory.

The function does not read any data and returns always 0.


Im using CVI 6.0 on NT 4.0 machine.


Thanks for any help



Thomas Groetzbach
(Germany)
0 Kudos
Message 1 of 7
(4,034 Views)
1.   There is no built-in method to change the base path of the shortcut. This would be a rarely used feature, as the shortcut created on the start menu uses an absolute path to reach the executable. The base path is ignored by windows when the shortcut path is absolute.

2. There is no 'working directory' parameter for 'Ini_GetRawStringIntoBuffer'. So I assume you are referring to the 'section name' parameter. Section name is a required parameter for this function, and I believe section names are required for each part of the .ini file. I think you are mistaking this parameter for a directory location.

regards,
Eric

Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(4,033 Views)
I too with to set the working directory of the shortcut. I disagree that it is rarely used - if the application looks for data relative to the application directory you would like the working directory set.
0 Kudos
Message 3 of 7
(4,033 Views)
I too with to set the working directory of the shortcut. I disagree that it is rarely used - if the application looks for data relative to the application directory you would like the working directory set.
0 Kudos
Message 4 of 7
(4,033 Views)
regarding 1:
in CVI 6.0, the new install is broken (or its behaviour was changed on purpose) and the shortcut created on the start menu runs the executable in the current directory (".") instead of the executable path. It is a problem with application that were using GetDir. GetProjectDir fixes the problem though.
0 Kudos
Message 5 of 7
(4,033 Views)
Surely ini files are old-fashioned, outmoded, and difficult to use. I've always put everything I needed in the registry.
0 Kudos
Message 6 of 7
(4,034 Views)
To define working dir for your app after launching it from .lnk file, use GetModuleFileName MS SDK function directly after application start.
0 Kudos
Message 7 of 7
(4,033 Views)