it is my understanding that when setting the product version through InstallShield, the registry gets written out to:
I am using C# and need to access the ProductVersion. I have tried the following in my code.
RegistryKey rk =
// Get the data from a specified item in the key.
String s = (String)rk.GetValue("CurrentVersion");
My problem is accessing the actual property: INSTALLPROPERTY_VERSION
which stores the version number...
If you are comfortable with COM then you can use the Windows Installer automation interface.
You need to include the msi.dll ( Microsoft Windows Installer Automation Support) in the project. Then you can create the Installer object. Once the object is created you can use the OpenPackage() function. Read the Windows Installer help library articles on automation interface. It would save a lot of trouble fiddling with the registry.
Hope this helps
Thank you for your reply. I have done some research regarding the automation interface. However, it seems as if I can only use that in my InstallShield project and not my actual application. I can set the version for InstallShield via General Information. Then when I install the application using InstallShield, it provides the version number in Add/Remove Programs in the Control Panel. I want to use this version for my application version in the Help//About box. I know the information has to be written to a registry somewhere, I'm just not sure how to access it.
Also, the automation interface appears to be a helpful tool....
there are many methods that can be used to find out information, but only on the InstallShield side.
Windows Installer automation interface can be used even outside Installation context. Its a pretty helpful api. You can copy and paste the VBScript code below in a text file and save it with a .vbs extension. Double click on the file to display a version of the product with a specified GUID. Do not forget to set the value of the MyProductCode variable.
MyProductCode="" 'Your product code goes within the quotes
Hope this gives you an idea. There is a book called VB/VBA developers Guide to Windows Installer by Mike Gunderloy. That is a good resource if you want to get rolling with Windows Installer. Also the Windows Installer SDK includes a lot of sample VBScripts. You can download the Windows Installer SDK from microsoft's platform SDK site.
I will definitely do some more research on the automation interface. I was unaware that you could use this interface outside of installation. (still a newbie) Also, thanks for the reference to the book, it will probably be my next investment.
For the meantime, in case anyone was wondering, I found out how to set the registry in InstallShield. I didn't realize that InstallShield didn't write anything out to the target computer's registry automatically. So what I did, is created a text registy and added to Software\"My Product". Then when I install, the registry is written. Now in the code of my project I use the following statements. C#
// Create a RegistryKey, which will access the
//HKEY_CURRENT_USER key in the registry of this machine.
//aString for the path to the values in the registry
string aRegString = "Software\\AccelSurvey";
//Assign the registry key to the local machine
RegistryKey aRegKey = Registry.LocalMachine.OpenSubKey(aRegString);
string aVersion = (string)aRegKey.GetValue("Version");
//Close the Registry Key
//Assign the version number to a label
lblVersion.Text = aVersion;
Thanks again for your help mr_anderson