How to make "VB6 package Install" Drive Independent??
Hi All,
How r u?
I want to make package for my VB 6.0 project so that where ever(Whatever drive/ path ) I install it, it works fine without any database or any project file path not found problems.
My project is using one database also.
Thanks In advance.
Regards
Krishna
Re: How to make "VB6 package Install" Drive Independent??
Always install the database in the same path as the exe and use App.Path in your project.
Re: How to make "VB6 package Install" Drive Independent??
That isn't a particularly good idea, because it can cause various issues (permissions etc) depending on the circumstances.
It would be much better to use an %AppData% folder instead, which also has extra benefits.
For more information (including apt code), see the article Where should I store the files that my program uses/creates? from our Classic VB FAQs
Re: How to make "VB6 package Install" Drive Independent??
Quote:
Originally Posted by
Hack
Always install the database in the same path as the exe and use App.Path in your project.
How about in Vista?
Re: How to make "VB6 package Install" Drive Independent??
Put your exe in program files
And the other files:
use the SHGetFolderPath function to set db and file paths
CSIDL_COMMON_DOCUMENTS (Public folder)
My app works like this:
Sub main gets the path to CSIDL_COMMON_DOCUMENTS and assigns it to a global string variable eg: gMyPath then through-out app refers to gMyPath
Re: How to make "VB6 package Install" Drive Independent??
Quote:
Originally Posted by
dee-u
How about in Vista?
I assume you have tried the same as Hack mentioned in Vista?
Re: How to make "VB6 package Install" Drive Independent??
It can fail rather impressively in Vista (and presumably 7), and will also fail in XP/2000 under certain circumstances.
The link I posted before explains the kind of issues it causes.
Re: How to make "VB6 package Install" Drive Independent??
The problem with CSIDL_COMMON_DOCUMENTS is that it is the common workspace for user documents. This is almost as bad as just dumping files onto the Desktop (or Common Desktop).
For shared files used by programs there is an official place to put things: CSIDL_COMMON_APPDATA.
Quote:
The file system directory that contains application data for all users. A typical path is C:\Documents and Settings\All Users\Application Data. This folder is used for application data that is not user specific. For example, an application can store a spell-check dictionary, a database of clip art, or a log file in the CSIDL_COMMON_APPDATA folder. This information will not roam and is available to anyone using the computer.
The hitch is that files and folders created here inherit security that makes them read-only except to the user who created (owns) them.
So normally your installer would create your app subdirectory here and give it appropriate access rights. Sometimes this can be as easy as Full Access for the Everyone group.
Do not use the values from various environment variables. For example %APPDATA% points to a folder in the user's roaming profile. People sort of get upset when every logon and logoff several GB of data has to be copied across the network. You won't see this on your home PC, but just wait until a user or two in a corporate setting gets yelled at for this.