Solved

Customize a file icon

Posted on 1998-05-04
2
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

623 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