LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Make the data for a registry key point to the installation folder of my app.

I have an application that creates files with a unique file extension (.myextension).  These files should be associated with a particular icon so that the icon is shown when they are viewed in Windows Explorer, etc.  I know how to do this when I create an installer by adding several registry keys and values under the [HKEY_CLASSES_ROOT] key as shown below.
 
 
                   key                                                name              type                                   data
 
[HKEY_CLASSES_ROOT]
     .myextension                                         (Default)          REG_SZ               Myextension.file.type.record
     Myextension.file.type.record              (Default)          REG_SZ               Text description of file type
               DefaultIcon                                  (Default)          REG_SZ               path to the icon file.
 
 
The key for the file extension record (.myextension) has a default value where the data points to the key for the file type record (Myextension.file.type.record).  The data for the default value of the Myextension.file.type.record key is just a description for the file type.  There is also a subkey called DefaultIcon.  The data for it's default value is the path to the file containing the icon that is to associated with the file type.  If the file contains more than one icon, it may be necessary to modify the data (path) to indicate which icon to use.
 
So, this is all good if path to the file containing the icon is known.  I added an icon file to the build when I built my application and it will be installed in a known location within the directory where my application is installed.  The location is [InstallDirectory]data\myicon.ico, where [InstallDirectory] is the directory where my application is installed.  The installation process, including the addition of registry keys is handled by an installer that I have created.  The problem arises when the user choses to install to a location other than the default directory specified in the installer.  I can't know before hand where that will be.  How can I specify the path in the DefaultIcon key so that it points to the correct location after installation?  Is there some symbol that I can use for the installation directory so that the path will be set correctly at installation time? 
0 Kudos
Message 1 of 3
(3,103 Views)
Hi cbfsystems,

If correctly understand what you are trying to do, check this out.  This shows you how to add a user-specified install directory to a registry entry in the installer build spec.

Cheers,
Brian A.
National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(3,074 Views)
Thankyou very much.  That is exactly what I was looking for.
0 Kudos
Message 3 of 3
(3,062 Views)