How to register file type with windows
Hello all,
My application creates a file using a proprietary format... Let's say something like "myFile.stan". My question is, how do I register this filetype (.stan) with windows so that when someone double-click on the file, windows will open it with my application? This application will be distributed as standalone exe file (no installation). I've seen some applications that do the same thing. The users just have to copy the exe file to some directory in their local harddrive and run it once. It then will register in windows. After that, the users can double-click on any of its files and the program will launch and open that file.
Thanks for any guidance/inputs.
Re: How to register file type with windows
Re: How to register file type with windows
You just need to do that pragmatically. Take a look at the Registry Class
Re: How to register file type with windows
it is done via the registry. In HKCR put 2 keys. 1 named .stan and other named stanfile. In the .stan in the (predefined) put "stanfile"(no quotes) and in stanfile create a folder named "DefaultIcon", other "Shell", in stanfile , in (predefinied) put the icon's path, in Shell create a key named "Open", in Open create a key named "Command" and in the (Predefinied) of command put (root of your app)\(yourapp).exe "%1" (including quotes). and it's done. It will work automatically, but the icons are set when windows restarts.