Question

Is there any way to do so in C or C++ (I know that it can be done in C#, so if you know how to, it'd also help!)?

What I want is a way to, automatically and through my own application, associate a custom file extension with a custom icon. For example, something that would make all current and subsequent .foo files have an image of their own, instead of the bland white paper sheet default. Just like what Java does to .jar files and Dev-C++ to .c and .cpp upon them being installed.

Through my researches I've found a lot of related information about a thing called Shell or something. I wound up myself at this page, and as viable what it says may seem, I have no idea on how to implement it at all, nor grasp what exactly it is about. Sorry if I sound noobish!

OS is Windows.

Was it helpful?

Solution

First you need to know how to modify registry in c++, here is a post that explains that:

Registry and c++

In the link you provided you have the keys that you need to update

HKEY_CLASSES_ROOT/[yourextension]

the call to SHChangeNotify is only needed to tell explorer to refresh once you modified the icon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top