PDA

View Full Version : HOWTO: Create a File Association



Support
10-04-2002, 02:37 PM
<HTML><HEAD><TITLE>HOWTO: Create a File Association</TITLE></HEAD><BODY><h3>HOWTO: Create a File Association</h3><b>Document ID: IR02017</b><hr>The information in this article applies to:<ul><li>Setup Factory 6.0</li></ul><hr><h3>SUMMARY</h3><p>This article explains how to create an association between a program and a given file type.</p><h3>DISCUSSION</h3><p>In order to set up a file association we will need to use two <b>Modify Registry</b> actions and an optional third <b>Modify Registry</b> action.</p><p><b>Example</b></p><p>This example creates a file association between the file extension *.KQX and the program %AppDir%\MyProgram.exe.</p><p>The first <b>Modify Registry</b> action will link the *.KQX file extension with "KQXEditor" which is another registry key:</p><pre><code><b>Registry Action:</b> Set Value<br><b>Main Key:</b> HKEY_CLASSES_ROOT<br><b>Sub Key:</b> .KQX<br><b>Value Name:</b> <br><b>Value Type:</b> REG_SZ<br><b>Value Data:</b> KQXEditor</code></pre><p>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 <b>Modify Registry</b> action will create the KQXEditor registry key:</p><pre><code><b>Registry Action:</b> Set Value<br><b>Main Key:</b> HKEY_CLASSES_ROOT<br><b>Sub Key:</b> KQXEditor\shell\open\command<br><b>Value Name:</b> <br><b>Value Type:</b> REG_SZ<br><b>Value Data:</b> %AppDir%\MyProgram.exe "%1"</code></pre><p>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:</p><pre><code><b>Registry Action:</b> Set Value<br><b>Main Key:</b> HKEY_CLASSES_ROOT<br><b>Sub Key:</b> KQXEditor\DefaultIcon<br><b>Value Name:</b> <br><b>Value Type:</b> REG_SZ<br><b>Value Data:</b> %AppDir%\MyProgram.exe,0</code></pre><h3>MORE INFORMATION</h3><p>For more information please see the following topics in the Setup Factory 6.0 Help:<br><br><li><b>Command Reference | Actions | Individual Actions | Modify Registry</b></li></p><p>KEYWORDS: Setup Factory 6.0, File Association</p><hr><FONT SIZE=1>Last reviewed: October 4, 2002<br>Copyright 2002 <A HREF="http://www.indigorose.com" target="blank">Indigo Rose Corporation</a>. All rights reserved.<br></FONT></BODY></HTML>