Solved

Customize a file icon

Posted on 1998-05-04
2
176 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video discusses moving either the default database or any database to a new volume.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now