|
-
Jul 9th, 2004, 03:25 PM
#1
Thread Starter
Member
Finding Install Directory
How can I find the directory my program was installed to?
Let's say a user installed it in C:\MyApp
My program then puts the Excel files is uses in there aswell.
C:\MyApp\MyApp.exe
C:\MyApp\MyExcelFile1.xls
C:\MyApp\MyExcelFile2.xls
I'm reading the .xls files from MyApp.exe so I'ld like to know the location of the .xls files.
To do this I've found: Application.StartupPath
but when a user copies my application to run from somewhere else the startuppath doesn't help me finding my .xls files, they are still where the application was installed.
Anyone?
-
Jul 9th, 2004, 04:45 PM
#2
Hi.
I don't know how, but I know that you can make a registry key during setup.
Then your program could read that key.
But it shouldn't even be an issue, IMHO. Users aren't supposed to move files around like that. Try moving Excel.exe or any other exe file without moving the rest of the app. It'd probably crash.
If the user needs the app to be in another directory they should uninstall and reinstall in another location.
At least, that's just my 2 cents.
I wish I could think of something witty to put in my sig...
...Currently using VS2013...
-
Jul 9th, 2004, 08:26 PM
#3
Lively Member
You could write a recursive function to find a particular file name using the DIR command or the file system object. Then run this on the known file names if they are not found in the Application.StartupPath location.
HTH
Hume
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|