Click here to Skip to main content
15,883,705 members
Articles / Programming Languages / C++

Changing the Default Icon of the Folders

Rate me:
Please Sign up or sign in to vote.
4.08/5 (6 votes)
13 Nov 2001CPOL3 min read 151.6K   1.4K   28   10
An article on changing the Default Icons of the Folders

Sample Image - Picture1.jpg

Introduction

Did you ever wanted to change the default icons of the Folders in the windows explorer? May be you want to. And you may tried to find the technique. If you could not found that till now then let me tell you that how can you do that. Look at the image above. The name "Learn and Deploy" do not shows any file, but it is a folder. And similarly, the Programmes is also a folder. Now let's discuss the magic behind this.

To do this, what you have to do is to find an icon which you want to be displayed instead of the original/default folder icon. And then you have to prepare a file named Desktop.ini. Put both files inside the folder which you want to change and there is one step more. But let we discuss first what is the file actually (Desktop.ini)

Desktop.ini is used to save the desktop configurations. But here we will use this file to change the icons of the folders and some attributes of that folder. If you want to write a Desktop.ini, then you can. But your desktop.ini may look like this

[.ShellClassInfo]
ConfirmFileOp=1
NoSharing=1
IconFile=Folder2.ico
IconIndex=0
InfoTip=I hate learning. Let we play, instead....More article text...

OK. Let's discuss this file in detail. The [.ShellClassInfo] is the header of the file and must be present before anything else. The ConfirmFileOp tells that either the folder is a system folder on an ordinary folder. If you equals this to 1, it will be considered as the sytem folder. Windows will popup a message telling that this is a system folder and any change may be dangerous for your system, when you will try to delete or move any file from this folder. NoSharing, name shows that this folder should be shared or not. 1 will not allow to share this folder. and 0 shows doesn't matter if any one share this folder. IconFile is the name of the Icon File which should be replaced by the original icon. IconIndex can be used if you are using icon from an .exe or other file. In that case, you must have to mention the index of the icon. If you are using Stand alone icon file (like with extansion .ico) then this should be 0. InfoTip will display the tip when you will move your cursor on the folder, or when you will select the folder then it will appear on the left pane (when Show as Web Page is true, See above).

That's all. You have created the Desktop.ini file, and you have an icon file. Put them inside the folder. You can hide and make them read only for your safety. But there is no compulsion for this. Now change the attribute of the folder to system. You can do this from the command prompt. Like goto the DOS prompt and then change the folder one step before your folder and then issue the command

Attrib +s <FolderName>

Where <FolderName> is the name of your folder. That's all. Go back to explore your folder. It's icon has been changed.

Just go inside the folder. You should notice onething more. See the picture below.

Image 2

Notice that at each place, where the folder name appears, your folder's icon is replaced instead of default icon.

This was just the basics of changing the folder icon. You can check more on this topic in the MSDN where they discussed the use of Folder.htt file too to have more changes.

If you think that there is something wrong, then you can contact me at any time. I will be available after 12:00 or before 12:00. I am including the sample with this article. You can check that. Bye upto that time.

Be angry coder with theAngrycodeR

Sameers, SameerS@theangrycoder.com

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Questionhow windows XP do this?? Pin
27-Jun-02 7:33
suss27-Jun-02 7:33 
Generaldefault icon for C and D drive Pin
kasturirawat15-Nov-01 12:21
kasturirawat15-Nov-01 12:21 
GeneralRe: default icon for C and D drive Pin
3-Mar-02 21:50
suss3-Mar-02 21:50 
GeneralRe: default icon for C and D drive Pin
Jon Newman2-Apr-02 7:05
Jon Newman2-Apr-02 7:05 
GeneralRe: default icon for C and D drive Pin
lpoi09816-Oct-07 2:33
lpoi09816-Oct-07 2:33 
GeneralRe: default icon for C and D drive Pin
Maxzz7-Apr-02 23:22
Maxzz7-Apr-02 23:22 
GeneralRe: default icon for C and D drive Pin
sanskypotov31-Mar-03 21:04
sanskypotov31-Mar-03 21:04 
GeneralRe: default icon for C and D drive Pin
Maxzz13-Apr-03 22:28
Maxzz13-Apr-03 22:28 
GeneralRe: default icon for C and D drive Pin
sanskypotov13-Apr-03 22:59
sanskypotov13-Apr-03 22:59 
GeneralRe: default icon for C and D drive Pin
tomsmaily12323-May-07 17:05
tomsmaily12323-May-07 17:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.