- NSIS Discussion
- How to Register File Types?
Archive: How to Register File Types?
mcrbids
27th June 2003 01:54 UTC
How to Register File Types?
I'm attempting to write an installer for a php-gtk program. I've figured out most of it, except that I need to register the ".php" filetype with the correct executable so that the application will actually run.
I can't find this anywhere in the documentation... how do I do this?
I want to register the ".php" filetype with application
c:\Program Files\php4\php_gtk.exe
Thanks!
Vytautas
27th June 2003 02:57 UTC
What you need is to create some registry keys/enties in
HKEY_LOCAL_MACHINE\Software\Classes
first you need to create a ".php" key with the description of the file type. Then create a key with the description as the name.
Check the registy for some examples of the keys/entries.
Vytautas
kichik
27th June 2003 12:41 UTC
The NSIS installer registers .nsi and .nsh. Its source code can be found in Examples\makensis.nsi. Is someone up to creating an Archive page for this?
Vytautas
27th June 2003 14:52 UTC
Archive page created here :)
Vytautas
kichik
27th June 2003 20:14 UTC
Thanks.
The code you've copied also backups the old value so it would be nice if you include the uninstall part too that shows the reinsertion of the backuped value.
Vytautas
28th June 2003 02:47 UTC
Will do as soon as i can, probably in a few hours
Vytautas
Vytautas
28th June 2003 06:36 UTC
Updated archive page to include restoration script for uninstaller. Thanks kichik for pointing this out.
Vytautas
rene@alquesm.dk
23rd November 2004 13:49 UTC
Note
Jsut wanted to add, that according to the MSDN, it's important to notify the system that you have made a change. You do this with the function SHChangeNotify. To notify Windows of a file association change, call the function like this:
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_DWORD, NULL, NULL);
If you do not call this function, Windows might not recognize your new filetype, or the change you made, before the system has been restarted.
Best regards
René Gundersen (rene@alquesm.dk)
super-llooyd
7th December 2005 23:55 UTC
how do i call this SHChangeNotify?
(in NSIS I mean?)
dandaman32
8th December 2005 03:26 UTC
Use the System plugin.
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)'
-dandaman32
IGC
14th July 2006 22:18 UTC
I have a question regarding this...
I was able to register the .igc extensions with my program.
Everytime I click on one of the .igc files the program executes correctly BUT..
The parameter passed to the program (the .igc file clicked) has a limited length. When that limit is passed the parameter contains tildes (~) on the path and in the filename.
For example: I click on "D:/Documents/My_files/igc_files/file to open.igc", my program executes, but the paramter passed to the program is something like: "D:/DOCU~/MY~/IGC~/FILET~1.igc"
When this happens my program can't find the passed file and it is not opened.
How do I solve this problem?
It does not affect the execution of the program, and if I use the Open button on my program the files open correctly, but it is an extrange behaviour that can be viewed as a bug on the code...
EDIT:
I found the source of the problem...
after shell\open\command I forgot to put quotes between the path to my executable. I do not know how that affects the arguments passed to the program, but it does.
Everything works perfect now.