• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:


Hello experts.

I'd need help.
I'm trying to make a setup for my program.
Well... What I need exactly is to associate a file extension to my program (Not the setup :-) and program icon.
Lets assume the name of the program is "Program1.Exe", and the extension is ".Cir", And the name of the icon is "PrgIcon.Ico".

From this moment and on, when the user dclicks a file with extension "Cir", I want Windows to run my program with this command line "C:\path\FileName.Cir"

By the way, using Install Shield to make the setup program
There is a script sample but is not clear for me

1 Solution
knowledge base article from InstallShield's support site at http://support.installshield.com
*** InstallSite provides free resources for setup developers at
*** http://www.geocities.com/SiliconValley/Peaks/5537/
HOWTO: Associating a File Extension with my Application's Executable Files Document ID: Q101360
This article applies to the following:
Product(s): InstallShield 5.0 Professional build 221 and earlier, InstallShield 5.0 Free Edition build 221 and earlier, InstallShield 5.0 Professional International West Edition build 219 and earlier
Last Revised On: 10/24/1997
How can I associate data files with my application's executable files such that when a user opens one of my data files, my application will be executed?
To associate a data file with an executable, you must register its file extension to point to your application's executable. You can create a file association from your setup script using the following method. Note that file associations created using this method will uninstall correctly on all platforms.
1. (Optional) Call the RegDBKeyExist function to determine whether an association already exists for the file type (extension) you are registering. If an association exists, there will be a root-level key for that file type under HKEY_CLASSES_ROOT. The root-level key may contain other subkeys or a reference to another root-level key that contains registration information. If your setup detects that this key exists, you may want to display a warning message for the end user before replacing this key. 2. Call the RegDBCreateKeyEx function to create the following key structure under the HKEY_CLASSES_ROOT key:
where .ext is the file extension being registered (including the period) Use separate calls to RegDBCreateKeyEx to create each key, as in the example below, so that these keys will be logged properly for uninstallation. 3. Call the RegDBSetKeyValueEx function to update the default value under the newly created command key. The default value for the key should contain the complete path and file name of the application's executable, followed by the string "%1".
Note: This section of the registry can be read by 16- or 32-bit
applications. Therefore, in a 32-bit setup it is recommended that you call the LongPathToShortPath function to convert the path to its short path equivalent before adding the value to the registry.

and i just knicked this example off a newsgroup:

The following example associates the .zzz file extension with Notepad.exe:
#define EXTENSION ".zzz"
BOOL bResult;
LONG lResult, lDisk;
STRING szPath;
    bResult = RegDBKeyExist(EXTENSION);
    if (bResult = TRUE) then
        lResult = AskYesNo ("Warning the extension (.zzz) is already registered. Overwrite?", YES);
        if (lResult = NO) then
    szPath = WINDIR ^ "Notepad.exe %1";
    LongPathToShortPath (szPath);
    RegDBCreateKeyEx (EXTENSION, "");
    RegDBCreateKeyEx (EXTENSION + "\\shell", "");     RegDBCreateKeyEx (EXTENSION + "\\shell\\open", "");     RegDBCreateKeyEx (EXTENSION + "\\shell\\open\\command", "");   RegDBSetKeyValueEx (EXTENSION + "\\shell\\open\\command", "", REGDB_STRING, szPath, -1);
MarscAuthor Commented:
Thanks Chensu...

And Thanks to Inthe to.
You deserve points to... but you know...
E-E doesn't support points divition :-)

Thanks anyway.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now