how can my program tell windows that a certain file extension opens with my program?
This is a discussion on extensions within the Windows Programming forums, part of the Platform Specific Boards category; how can my program tell windows that a certain file extension opens with my program?...
how can my program tell windows that a certain file extension opens with my program?
In a perfect world every dog would have a home and every home would have a dog.
Visit My Web Site, Canine Programming
I use Win32 API
have your program edit
HKEY_CLASSES_ROOT/.FileType
to have the path of your filename in the default key. I think wc.hIconSm is the picture shown on the icons for files opening with your program, but I'm not sure.
Gays can't love like real people
entropysink.com -- because arses weren't designed for running websites.
hmmm. i can't get it to work. could i have an example?
In a perfect world every dog would have a home and every home would have a dog.
Visit My Web Site, Canine Programming
I use Win32 API
Okay...
do this with regedit first and then you can look at it with registry functions
Your proggie needs to be able to accept a file name as an arg to WinMain and then open it when excecuted.
Open regedit and go to the HKEY_CLASSES_ROOT. Create a new subkey called "mywinfile". Under this create a subkey called "shell" and under this another subkey called "open". Under that put yet another key called "command". In the default entry of command, type the path of your app followed by "%1". So it will look like "C:\myprog %1".
Therefore your key will look like;
with the default entry of "command" edited as aboveCode:HKEY_CLASSES_ROOT |____mywinfile |____shell |____open |____command
Now, under HKEY_CLASSES_ROOT, create another subkey and name it with the extension you want your app to open. For instance if you want to open .mywinf, you would name the key ".mywinf". Now under the default of this key enter the name of the other subkey - "mywinfile".
now when you rightclick "somefile.mywinf" you get an open option and as long as your prog is setup, it will open
Go to start, settings, folder options (if you don't find it there, its in control panel). Then click on the 'File Types' tab. Then find the file type that you want then edit it so that it uses your program to open a file of that type.
Please direct all complaints regarding this post to the nearest brick wallHave a nice day.