0

Greetings.
I've done a search regarding the above subject.
I came across this page: CreateFileAssociation

I'm on my way in developing a desktop application and I need to implement my own file format to store data in the way I want it to be. I'm quite uncertain as to how should I go about first. Anyone here has any idea? How can I benefit from the content of the above link? What do I have to know before implementing this? Thanks a lot.

2
Contributors
6
Replies
9
Views
12 Years
Discussion Span
Last Post by red_evolve
0

Creating the association means that anytime someone double-clicks on a file with 'your' extension, your program will be launched and your WinMain will get the file name so you can open the file and do whatever you want with it.

So, if that's what you WANT, then this code is for you (and/or having your installer do it for you).

Pick an extension that no one else is using, or you'll have upset customers. In particular, there can be a large number of extensions for images, sounds, videos, and the like. So go to a 'fully loaded' machine with photoshop or its ilk on it, and then look in the registry under the file classes key and you'll see 50-100 extensions already there. Pick something ELSE.

An easy way to avoid these common other files is to pick an extension longer than 3 chars, though there may be compatability issues on non-windows OS', if that matters to you.

0

Thanks for your feedback.
Err, the thing that is still confusing me is that piece of code provided with the link.
Is it giving me a direction? May I know what does that piece of code do?
A wild guess, it creates a registry key and set the registry key for a new extension? Does any other application with their own extension do this everytime?

0

The MS File Explorer program and others like it, when coming across a file with an extension, look in the registry in a specifc location to see what program is associated with that file's extension.

This code snippet sets the registry up so that those programs can find your program. You only need to do this once at installation time.

As I say, all this does is allow someone to see your file in Explorer, double click on it, and have that run your program.

0

Okay. So, that means that there is nothing else that I'd have to take care on the file extension creation thing other than just setting up the registry key during installation time?

1

Heck give it a try and see! I haven't done this in a LONG time, so I may not have 100% of the steps down.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.