How to associate files with programs?
-
How to make Windows open specific files with a specific program??? Lets say i make a program which saves something to .fil -files, how to associate .fil files to my program ???
-
How to make Windows open specific files with a specific program??? Lets say i make a program which saves something to .fil -files, how to associate .fil files to my program ???
If you open your registry using regedit, and select HKEY_CLASSES_ROOT, you will see an enormous list of, amongst others, file extensions. Like...
*
._sln
.txt
.rarand so on. Each of these registry keys has their default string value set to the name of another key in HKEY_CLASSES_ROOT, like
.rar
has its default value set toWinRAR
. If you go to theWinRAR
key in HKEY_CLASSES_ROOT, it will have various properties to it. Its default value is set to the what the file is for - "WinRAR Archive" in this case. A sub key of the WinRAR key isshell
which in turn has a sub keyopen
. The default value of theopen
key is what you want to appear as the default menu item in the context menu that is shown when a user right-clicks on a file of this type in Windows Explorer. Inside this key is another sub key calledcommand
. The default value of this is where you can set the program you want to launch when someone opens the file. You can use "%1" to represent the file path - so if you wanted to load the file in notepad, you could set the default to"notepad.exe" "%1"
So an example hierarchy for a new file type of extension .fil, if you wanted to launch it with say "MyApp" could be...
HKEY_CLASSES_ROOT
-> .fil
* (Default) = filfile
-> filfile
* (Default) = fil File
-> shell
-> open
* (Default) = Open this fil file with MyApp
-> command
* (Default) = "C:\Path To MyApp\MyApp.exe" "%1"(where '->' represents a key, and '*' represents a value) Hope that helps (and makes sense) :) Cheers, Will H
-
How to make Windows open specific files with a specific program??? Lets say i make a program which saves something to .fil -files, how to associate .fil files to my program ???
I am not a big fan of messin around with the registry. I'm running XP so this is what i would try: open any folder. Under the Tools menu ... select Folder Options Under Folder Options ... select File Types I've never done it, but it looks like you can make a file association right there. Just press the NEW button, enter the file extension and press okay. This will cause the new file extension to be displayed (and selected) along with all the others. Next, press the CHANGE button next to the "Opens with" thingie, locate the program you wish to associate with that extension, and you are in business ... maybe, hopefully, possibly ... lol. Good luck :)