PDA

View Full Version : Registering a file extension



Wakerunner
02-27-2008, 06:09 PM
I am having a problem with registering a file extension.

After running the install my app does not execute when double clicking on the file type. I get a message "The parameter is incorrect" also the icon is not being used for the target files on the computer, it is using the standard icon when no icon is specified.

Below is how I have the fields filled in.

test Extensions

Feature: Always Install
File: [INSTALLDIR]Myprog.exe
Command: &Open with Myprog
Arguments: -v%1
ProgID: test.file
Description: My File
Icon File: C:\myicon.ico
Icon Index: 0

I have tried several different ways to fill in argument such as "-v %1" (with " 's) and nothing seems to work.

Am I filling the fields correctly? Can somebody tell me what I am doing wrong?

---------------------- Updated... cause of the problem below---------------------------------------------------
I found the problem. If you have "Use add remove programs" set to no the file extensions are not setup right during install. Turn "Use add remove programs" to yes and it does work.

This is a bug in ISX 2008.

I need to know if there is a fix for this, I have projects that cannot be registered in add/remove programs.


------------Updated below... how to use registry settings for file extensions---------------------------------------------

I wanted to post this, maybe it will save somebody else the 2 days of work it took me to find out that ISX 2008 does not register extensions correctly if you do not have your prgram set to register with Add/Remove programs in Windows.

To register file extensions to your program if you do not want your program registered in Add/Remove programs you can use the registry functions in InstallShield 2008 Express.

The text below the ---- line below can be copied and pasted into notepad and saved as "Whatever you want.reg". You can then edit it for your program and then import it into IS2008X by going into Registry, right clicking on HKEY_CLASSES_ROOT then click "Import Reg File", then browse to your "Whatever you want.reg" file that you edited and saved.

The settings below will use the same icon as your program file for the icon of the files with the registered extension. Also when a registered file is double clicked your app would be launched with "filename.YourEXT" as the command line, so make sure your program checks the command line for for an entry ending in ".YourEXT".


The text below has to be edited as follows:
Replace all instances of the following
"YourProg.YourEXT" with Your program name.Your extension
"Your file description" with Whatever you want the description of the file to be
"&Open with Your Program" with Whatever command you want to use and your program name
"Your Program.exe" with your actual program executable file name
".YourEXT" with your actual file extension you want to register example .txt or .bmp

--------------Copy and paste below this line---------------------------------------------------------
REGEDIT4

[HKEY_CLASSES_ROOT]

[HKEY_CLASSES_ROOT\YourProg.YourEXT]
@="Your file description"

[HKEY_CLASSES_ROOT\YourProg.YourEXT\shell]

[HKEY_CLASSES_ROOT\YourProg.YourEXT\shell\&Open with Your Program name]

[HKEY_CLASSES_ROOT\YourProg.YourEXT\shell\&Open with Your Program name\command]
@="[INSTALLDIR]Your Program.exe %1"

[HKEY_CLASSES_ROOT\YourProg.YourEXT\DefaultIcon]
@="[INSTALLDIR]Your Program.exe"

[HKEY_CLASSES_ROOT\.YourEXT]
@="YourProg.YourEXT"

[HKEY_CURRENT_USER]

[HKEY_LOCAL_MACHINE]

[HKEY_LOCAL_MACHINE\SOFTWARE]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT]
@="Your description for the file"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\shell\&Open with Your Program Name]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\shell\&Open with Your Program Name\command]
@="[INSTALLDIR]Your Program.exe %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\DefaultIcon]
@="[INSTALLDIR]Your Program.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.YourEXT]
@="YourProg.YourEXT"

[HKEY_LOCAL_MACHINE\SYSTEM]

[HKEY_USERS]

[HKEY_USER_SELECTABLE]

Wakerunner
02-28-2008, 11:07 AM
Just wanted to add, after I install if I go into Tools>Folder Options> File Types then go into the advanced tab for that extension, then click edit and simply press OK and OK, without making any changes the extension starts working. The Icon is still missing but it launches my program when I double click on it.

Does anybody actually monitor these forums?

SherylSikora
02-28-2008, 01:41 PM
Try setting up the argument as such with the quotes:

-v "%1"

Although I am not sure why the icon is not displaying for you, there are a couple of things you can check:
1. Is there really an icon resource in the .ico file that would use an index of 0?
2. Does an icon retrieved from another type of resource such as an .exe or .dll file work for you?

Wakerunner
02-28-2008, 03:03 PM
I took out the -v switch and edited my program to not need it. I have tried it like %1 and also "%1" either way it does not work after install.

The icon is a .ico file and index 0 is the only icon present in it, when you click on the change icon ".." and the change icon dialog is displayed it does display the correct icon and it shows it as index 0. I tried using an icon from an exe file with the same results.

SherylSikora
02-28-2008, 03:28 PM
Can you try the most basic scenario in a new project? Just add your .exe file, and setup the the File Extension as you normally would, build the install and try installing to see if that works for you.

I want to rule out any odd behavior with an older or upgraded project.

Also, what kind of release are you building - single image, CD-ROM, etc. You may want to try a CD-ROM image so that you can open up the .msi file (with a tool like Orca) and verify that all table entries are correct for your extension. The tables to verify are the following:
Extension
Verb
ProgId
Icon

Wakerunner
02-28-2008, 04:09 PM
The project I was testing with is a single image, from a new project that was built from scratch with ISX 2008, I built it from scratch due to other problems after trying to upgrade a project from ISX 10.

I created a new project with only my exe and the extension set and it works. Whats the deal, does the extensions only work under certain conditions in ISX 2008? There has to be another setting in ISX 2008 that conflicts with the file extensions... what is it?

I guess I could spend a week going through and changing every setting on my project that is different than the test one that works and test it after every change to find out what it is... but then what, what if its a conflict with a setting I need??

This is a bug in ISX 2008, I'm sure I am not the only person running into this problem.

Wakerunner
02-28-2008, 06:06 PM
I found the problem. If you have "Use add remove programs" set to no the file extensions are not setup right during install. Turn "Use add remove programs" to yes and it does work.

This is a bug in ISX 2008.

I need to know if there is a fix for this, I have projects that cannot be registered in add/remove programs.

bryanwolf
02-29-2008, 09:14 AM
Because the Extension Table (http://msdn2.microsoft.com/en-us/library/aa368571.aspx) relies on Advertisement and you've disabled writing of the advertisement information by supressing Add/Remove Programs, this behavior may be a result of the limitations of Windows Installer.

Essentially, when you select "No" for add/remove programs, you are indicating to InstallShield that you want us to disable any of the product registration actions. We do this, but it has some unintentional side-effects.

If you wish, I can submit something to have this more fully documented as to what setting that option really does.

Wakerunner
02-29-2008, 09:50 AM
I have an open support incident with Installshield about this now. Are you with Installshield?

If it not a bug and just something that cannot be done with Add/Remove turned off then it should be documented. The support rep I talked to did not even know about it, I was the one who found what the problem was.

Wakerunner
02-29-2008, 01:26 PM
I wanted to post this, maybe it will save somebody else the 2 days of work it took me to find out that ISX 2008 does not register extensions correctly if you do not have your prgram set to register with Add/Remove programs in Windows.

To register file extensions to your program if you do not want your program registered in Add/Remove programs you can use the registry functions in InstallShield 2008 Express.

The text below the ---- line below can be copied and pasted into notepad and saved as "Whatever you want.reg". You can then edit it for your program and then import it into IS2008X by going into Registry, right clicking on HKEY_CLASSES_ROOT then click "Import Reg File", then browse to your "Whatever you want.reg" file that you edited and saved.

The settings below will use the same icon as your program file for the icon of the files with the registered extension. Also when a registered file is double clicked your app would be launched with "filename.YourEXT" as the command line, so make sure your program checks the command line for for an entry ending in ".YourEXT".


The text below has to be edited as follows:
Replace all instances of the following
"YourProg.YourEXT" with Your program name.Your extension
"Your file description" with Whatever you want the description of the file to be
"&Open with Your Program" with Whatever command you want to use and your program name
"Your Program.exe" with your actual program executable file name
".YourEXT" with your actual file extension you want to register example .txt or .bmp

--------------Copy and paste below this line---------------------------------------------------------
REGEDIT4

[HKEY_CLASSES_ROOT]

[HKEY_CLASSES_ROOT\YourProg.YourEXT]
@="Your file description"

[HKEY_CLASSES_ROOT\YourProg.YourEXT\shell]

[HKEY_CLASSES_ROOT\YourProg.YourEXT\shell\&Open with Your Program name]

[HKEY_CLASSES_ROOT\YourProg.YourEXT\shell\&Open with Your Program name\command]
@="[INSTALLDIR]Your Program.exe %1"

[HKEY_CLASSES_ROOT\YourProg.YourEXT\DefaultIcon]
@="[INSTALLDIR]Your Program.exe"

[HKEY_CLASSES_ROOT\.YourEXT]
@="YourProg.YourEXT"

[HKEY_CURRENT_USER]

[HKEY_LOCAL_MACHINE]

[HKEY_LOCAL_MACHINE\SOFTWARE]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT]
@="Your description for the file"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\shell\&Open with Your Program Name]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\shell\&Open with Your Program Name\command]
@="[INSTALLDIR]Your Program.exe %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\YourProg.YourEXT\DefaultIcon]
@="[INSTALLDIR]Your Program.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.YourEXT]
@="YourProg.YourEXT"

[HKEY_LOCAL_MACHINE\SYSTEM]

[HKEY_USERS]

[HKEY_USER_SELECTABLE]

kronosizm
05-06-2008, 08:13 AM
Hello Wakerunner ,
can you write a comlete code .reg file? this one is not clear enough:(
for example:
Program: executable.exe
Extension: .xyz
How would the .reg-code look like, if I were to register a .xyz extension and associate it with executable.exe?
Thanks in advance,

Wakerunner
05-16-2008, 09:10 AM
Sorry it took so long to reply, since the Installshield company changed their name again?..again? ..Really?? Email from them was getting caught in my spam filter.

I will create a sample for the following program information.

Program name: "Sample"
Program Description: "Sample Program"
Extension to register: ".xyz"
Executable name: "executable.exe"


The text below the ---- line below can be copied and pasted into notepad and saved as "Whatever you want.reg". You can then edit it for your program and then import it into IS2008X by going into Registry, right clicking on HKEY_CLASSES_ROOT then click "Import Reg File", then browse to your "Whatever you want.reg" file that you edited and saved.

See the original post for more info about using this.


---------------------------------------------------------------------------------------

REGEDIT4

[HKEY_CLASSES_ROOT]

[HKEY_CLASSES_ROOT\Sample.xyz]
@="Sample Program"

[HKEY_CLASSES_ROOT\Sample.xyz\shell]

[HKEY_CLASSES_ROOT\Sample.xyz\shell\&Open with Sample Program]

[HKEY_CLASSES_ROOT\Sample.xyz\shell\&Open with Sample Program\command]
@="[INSTALLDIR]executable.exe %1"

[HKEY_CLASSES_ROOT\Sample.xyz\DefaultIcon]
@="[INSTALLDIR]executable.exe"

[HKEY_CLASSES_ROOT\.xyz]
@="Sample.xyz"

[HKEY_CURRENT_USER]

[HKEY_LOCAL_MACHINE]

[HKEY_LOCAL_MACHINE\SOFTWARE]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Sample.xyz]
@="Your description for the file"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Sample.xyz\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Sample.xyz\shell\&Open with Sample Program]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Sample.xyz\shell\&Open with Sample Program\command]
@="[INSTALLDIR]executable.exe %1"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Sample.xyz\DefaultIcon]
@="[INSTALLDIR]executable.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.xyz]
@="Sample.xyz"

[HKEY_LOCAL_MACHINE\SYSTEM]

[HKEY_USERS]

[HKEY_USER_SELECTABLE]