Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Customize a file icon

Posted on 1998-05-04
2
Medium Priority
?
188 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 300 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

783 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