Prakash Joshi

Hi All,

I would like to set simple Icon to a file created by CFile class.

Please suggest a way how to set icon to file created through CFile.


-Prakash Joshi

Re: Visual C++ Language How To Set Icon To File

Nishant Sivakumar

I presuming you are generating a custom document. If that's so, Explorer will use the default icon for that document type (that's registered). If not, you should register an icon for that specific document type.

For an example, open HKEY_CLASSES_ROOT\chm.file\DefaultIcon using regedit and you'll see what you need to do.

Re: Visual C++ Language How To Set Icon To File

Prakash Joshi

Hi Nishant,

Thanks for Reply.

I have set a Icon with the help help of your reply.

i have created "DefaultIcon" Key under my file extension i.e. *.bpt and assigned value i.e. path of .ico file.

it is working fine, but now this is a hardcoded path and i have to supply .ico file separately.

it would be great if I can attach an ICON in dll resources and use the same.

please suggest how this "DefaultIcon" key can point to ICON resource from dll.

i have seen some other file's "DefaultIcon" which have value something like


what does this 6 mean

Prakash Joshi