Does anyone know how one would go about creating a "custom" file type? (Such as Macromedia Flash's .swf.. or quicktime's .mov)

Also.. once I have created a custom file type... how would I make sure that my file is always associated with a given icon (that I will create).. and will not appear with the unknown file format icon?

Thank you.

(Please note: I'm using Win32)

Recommended Answers

All 6 Replies

File associations are in the registry under HKEY_CLASSES_ROOT. Read this article.

Thank you for your post.. it's at least helped me to understand how to get an image associated with a file extension..

I've actually learned how to create a custom file extension with the fopen function.

However.. now I have a new problem. Not only do I want to be able to create a custom file extension.. but I would also like my file extension to do things.. when it is open.. Ex: When a .swf file is opened.. whatever was in that file.. is displayed on the screen. I would like to have it that when a person opens my custom file.. music starts playing (or something of the like)

Thanks.

You have to associate the file extension with some program. Here is how its done in VB. If there is no program that can read the file then you will have to write the program yourself.

If you don't want to convert that VB program to C++ then you can find may c++ registry classes. Here's one of them.

Here is another article I just ran across you might want to read.

Thank you so much.. your links have helped me out greatly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.