Summary
In Windows-based applications, it is common to have some of the files that a setup installs to be opened with a specific program. For example, a setup author might want all .ved files to be opened with Windows Notepad. This article provides InstallScript code that creates an association between the .ved extension and Notepad in the registry.Synopsis
In Windows-based applications, it is common to have some of the files that a setup installs to be opened with a specific program. For example, a setup author might want all .ved files to be opened with Windows Notepad. This article provides InstallScript code that creates an association between the .ved extension and Notepad in the registry.
Using the Explorer Shell, if you write the extension into the Extensions section of the Win.ini file, the information will be copied into the registry under the appropriate keys. Therefore, either modify the Win.ini file or the registry, but not both.
Note: Modifying the registry is easier under the Explorer shell since it is not necessary to define an application identification key. The \shell\open-print\command keys can be placed directly under the file extension key.
Applicable to Project Types:
Basic MSI
InstallScript
InstallScript MSI
Discussion
Attached below is a zip (Q100157.zip) that contains three script-based functions for creating and querying file associations in the registry on either the Explorer or Program Manager shells. To add to your setup, import these files into the <MYPROJECTDIR>\Script Files directory. Include the header file from the zip file (Q100157.zip) in the declarations block and the .rul file at the end of your script. You will then be able to call the functions anywhere in your script.
Additional Information
A file association can be created manually in the registry by following these steps:
To register a file extension you must do three things:
- Make a file extension key entry, such as:
HKEY_CLASSES_ROOT\.zzz=zzzFile
- Make an application (class) identification key entry, such as:
HKEY_CLASSES_ROOT\zzzFile=ZZZ File
- Make shell command key entries, such as the following:
HKEY_CLASSES_ROOT\zzzFile\shell\open\command=Notepad.exe %1
HKEY_CLASSES_ROOT\zzzFile\shell\print\command=Notepad.exe /P %1
Follow the above instructions to register the .zzz file extension and associate Notepad with the .zzz file extension.
To accomplish the above steps, it is suggested to use the InstallScript functions RegDBCreateKey and/or RegDBSetKeyValueEx to create these registry entries. This is also shown in the sample code included in the attached .rul file.
To see example code that calls the necessary InstallScript registry-related functions to complete steps 1-3, see the InstallShield Help Library topic "Registering file extensions example code."
Note: All extension information is stored under HKEY_CLASSES_ROOT.
Additional information on the InstallScript functions mentioned above, including sample code, can be found in the self-titled topics contained in the InstallShield Help Library. For example, for additional information on using RegDBCreateKeyEx, please see the InstallShield Help Library topic RegDBCreateKeyEx.
Related Articles
Creating File Association in Windows 9Number of Views Creating File Extension Association with Express 3Number of Views Create a Windows Registry Entry with Type REG_NONE for Windows File Type Association 6Number of Views How to Prevent Password Prompt by Creating a .pfx File from a .pvk File and .spc File 4Number of Views Create local file evidence in Flexera One ITAM or FlexNet Manager Suite 53Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Case id: 00001065
Activity: Status change: 2 hours ago