Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing ShortCut "Start In" Path 1

Status
Not open for further replies.

RileyCat

Programmer
Apr 5, 2004
124
0
0
US
Let me set up the situation.

I have a VB6 app running from a network share. Users access the EXE through a short cut on their desktop. The EXE automatically accesses it's INI file from the same directory where the EXE lives.

What I need to be able to do is to allow the users to have their own individual INI files on their workstations for this EXE.

Is there either (1) a way I can program in my VB6 code to access the shortcut's "Start In" path, or otherwise (2) direct the EXE to look for the INI file on the workstation rather than on the server where the EXE is running from???

Stay Cool Ya'll! [smile2]

-- Kristin
 
I did something similar recently. To solve this problem, I got the mac address of the computer running the executable, and then used it to name the configuration file.





-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Good idea.

Do you name the Config file with the machines mac addr at the time of install, or can this be dynamic?

How do you then access the INI file from the VB code?

How do you get to the mac addr in vb code?

Stay Cool Ya'll! [smile2]

-- Kristin
 
When a vb app runs you have two 'default' folders one is App.Path the other is CurDir$; these are usually the same however if the app is run from a Windows ShortCut CurDir$ will return the 'Startin' folder specified in it.
So if user configuration files are saved/ retrieved from CurDir$ and each user is given a Shortcut with a unique Startin Folder...

In your case such a Shortcut may have;
Target = \\SomeServer\MyAppFolder\MyApp.exe
Startin = C:\MyAppUserFolder
 
>> Do you name the Config file with the machines mac addr at the time of install, or can this be dynamic?

This was for an in-house project, so there was no install. But, there are several ways you can handle this. You could have a default configuration file, and user specific configuration files. When the application is run, you could check to see if the user's configuration file exists. If it does not, copy the default config file to the user's config file. This way, you will have default values that the user can easily change.


>> How do you then access the INI file from the VB code?
There are API Calls you can use to access ini files, but I seriously don't like that method. Instead, I usually open the config file when the application is loading, keep the config information in memory, and write to the config file when anything changes. For all of my file handling stuff, I use the File System Object.

>> How do you get to the mac addr in vb code?

thread222-874992

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top