Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Customize a file icon

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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 is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

722 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