[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Associating

Posted on 2000-04-16
3
Medium Priority
?
354 Views
Last Modified: 2013-12-03
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

Thanks.
0
Comment
Question by:Marsc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 210 total points
ID: 2721119
0
 
LVL 17

Expert Comment

by:inthe
ID: 2721132
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
Summary
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?
 
----------------------------------------------------------------------------
----
 
Discussion
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:
..ext\\shell\\open\\command
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;
program
    bResult = RegDBKeyExist(EXTENSION);
    if (bResult = TRUE) then
        lResult = AskYesNo ("Warning the extension (.zzz) is already registered. Overwrite?", YES);
        if (lResult = NO) then
          abort;
        endif;
  endif;
    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);
endprogram
 
0
 
LVL 1

Author Comment

by:Marsc
ID: 2723812
Thanks Chensu...

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

Thanks anyway.




0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question