HOWTO: Create a File Association
Document ID: IR02017The information in this article applies to:
- Setup Factory 6.0
SUMMARY
This article explains how to create an association between a program and a given file type.
DISCUSSION
In order to set up a file association we will need to use two Modify Registry actions and an optional third Modify Registry action.
Example
This example creates a file association between the file extension *.KQX and the program %AppDir%\MyProgram.exe.
The first Modify Registry action will link the *.KQX file extension with "KQXEditor" which is another registry key:
Registry Action: Set Value
Main Key: HKEY_CLASSES_ROOT
Sub Key: .KQX
Value Name:
Value Type: REG_SZ
Value Data: KQXEditor
The "KQXEditor" registry key will tell the operating system what to do with files that have the *.KQX extension. We will tell the operating system to open all files, with the *.KQX extension, with %AppDir%\MyProgram.exe. The next Modify Registry action will create the KQXEditor registry key:
Registry Action: Set Value
Main Key: HKEY_CLASSES_ROOT
Sub Key: KQXEditor\shell\open\command
Value Name:
Value Type: REG_SZ
Value Data: %AppDir%\MyProgram.exe "%1"
The third (and optional) step is to associate an icon with files using the *.KQX file extension. We will set the icon for all KQX files to be the same icon that our KQXEditor (%AppDir%\MyProgram.exe) uses:
Registry Action: Set Value
Main Key: HKEY_CLASSES_ROOT
Sub Key: KQXEditor\DefaultIcon
Value Name:
Value Type: REG_SZ
Value Data: %AppDir%\MyProgram.exe,0
MORE INFORMATION
For more information please see the following topics in the Setup Factory 6.0 Help:
KEYWORDS: Setup Factory 6.0, File Association
Last reviewed: October 4, 2002
Copyright © 2002 Indigo Rose Corporation. All rights reserved.
Comment