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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i write INSTALLDIR to registry? 1

Status
Not open for further replies.

bomburmusicmallet

Programmer
Nov 7, 2003
9
US
Hello,

Newbie question here... I've seen a few other threads deal with this issue, but no answers I've been able to use or understand.

I'm using Wise for Windows Installer v 5.1 - Standard Edition.

I want to write the application path to a key in the registry I'm creating during installation. I'd also like the end user to tell me the server name and database and write those to the registry too. (I will be calling this application from another with a shell command, so I need to know where the user has installed this application.)

Any information will be appreciated. Thanks!
 
The registry is easy. In the Installation Expert click Registry, select the key, Add, Key, Op=Create/update key and value,Root=whatever you selected, Key=Example: Software\My App, Value Name=Example: Installation Path, Data Vale=[INSTALLDIR], Data type=String

You can ask for the server/database with a custom action or a Windows Installer dialog box. The values received can be written to the registry using brackets (as in the example above). The data entry must occur before the WriteRegistryValues action.

If possible you should pull these values from the registry using the System Search function rather than prompting the user. If you do prompt the user then you may want to use a drop-down list or radio buttons to avoid data entry problems. A drop-down list is very easy to set up.

If you are running the MSI with /qb (for example) or have the LIMITUI property set then Windows Installer dialog boxes won't be displayed.

HtH,

Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Hi Rob,

Thank you! That helped very much, and was exactly the information I needed for the application path.

I set up a dialog box for the server and DB, and gave them property names of RR_SERVER and RR_DATABASE. I then created registry keys the same as above and put RR_SERVER and RR_DATABASE in brackets like I did INSTALLDIR. However, when I ran the installation, the values never made it into the registry (only my application path). What am I missing?

Thanks again!
 
One of two things...

1) You have your dialog happening after WriteRegistryValues. Go into tables then look at InstallExecuteSequence for WriteRegistryValues and InstallUISequence for your dialog. The sequence number of your dialog should be lower than the number for the write action.
2) You aren't using the same case for your variables RR_DATABASE is different than rr_database

You should add a registry system search (use the Installation Expert) to pre-populate the two variables. This way when a repair occurs or a new version is installed the two fields already have values in them.

You may also want to create a new component that will be left installed on uninstall and house the two registry keys there. This way the server/database values will remain behind so a user won't have to re-enter them on an upgrade.

HtH,

Rob
robschultz@yahoo.com
-Focus on the solution to the problem, not the obstacles in the way.-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top