Solved

Customize a file icon

Posted on 1998-05-04
2
182 Views
Last Modified: 2013-11-20
I've created a file in my application using the method Create from CFile.  The extension was ".cfg" an I wanted to have an icon made by my own associated to it so I could see it in the Explorer. How can I do it inside the code?  
   
0
Comment
Question by:marakr
2 Comments
 
LVL 7

Accepted Solution

by:
galkin earned 100 total points
ID: 1307194
You must create registry key ".cfg" under HKEY_CLASSES_ROOT. This key should have only one default value, which is desription of the file extension, say it is "cfgfile". Then you must create another key with the name of this description under the same HKEY_CLASSES_ROOT. In this case "cfgfile". This key in turn must have subkey "DefaultIcon" and its default value is path to EXE, DLL or ICO file followed by comma followed by icon index or icon ID prepended by minus.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 1307195
If your application is the one which is the server for this file type (ie. should be the one that knows how to open it and therefore has a doc template for it) then MFC should take care of this for you .. there should be an icon with the same ID as the doc info string (and menu) that your file type uses.

If this is some other sort of file type that is not handled by your program, then use the method proposed by galkin

0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
only14 challenge 19 84
has77  challenge 9 97
Unix Command -- Challenging  question 7 101
c++  placing data into a form and an editbox 5 21
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question