PerryDaynac
asked on
programatically change icon on folder
Hi Experts,
I have a program where the user creates a project consisting of a Access database and some pictures. I collect all files for a project in a folder and want it to look a little bit more professional by changing the icon of the folder to my own. How do I do that? I want to assign my own icon to the folder when I create it...
Thanks
Perry
I have a program where the user creates a project consisting of a Access database and some pictures. I collect all files for a project in a folder and want it to look a little bit more professional by changing the icon of the folder to my own. How do I do that? I want to assign my own icon to the folder when I create it...
Thanks
Perry
PerryDaynac; you have to add a file "Desktop.ini" into the folder that you want to change the icon
Then add the next code to that file ...
[.ShellClassInfo]
IconFile=c:\someIcon.ico
IconIndex=0
close and save the file "Desktop.ini" and your folder will have the icon that you deside.
All of this, you can do it with VB...
FerG
Saludos.
--
Ing. Fernando D. Giletta
San Fco. Cba. Argentina.
Then add the next code to that file ...
[.ShellClassInfo]
IconFile=c:\someIcon.ico
IconIndex=0
close and save the file "Desktop.ini" and your folder will have the icon that you deside.
All of this, you can do it with VB...
FerG
Saludos.
--
Ing. Fernando D. Giletta
San Fco. Cba. Argentina.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Brilliant Fernando!!
Works like a clock...
I have another question up about protecting the folder with a password, if you know how to do that aswell
Thank You
Works like a clock...
I have another question up about protecting the folder with a password, if you know how to do that aswell
Thank You
Excellent
It doesn't like programmatical setting of system file attributes, but you can use SyncShell (or if you don't want to go find SyncShell on the web, just plain old "Shell") to do this quite easily. This will set the attributes of Desktop.ini to both "system" and "hidden"
It's not necessary to set the folder path to read only, btw?
SyncShell "cmd.exe /c attrib """ & sFolderPath & "\Desktop.ini"" +s +h", vbHide
It's not necessary to set the folder path to read only, btw?
SyncShell "cmd.exe /c attrib """ & sFolderPath & "\Desktop.ini"" +s +h", vbHide
http://www.codeproject.com
Say something if you need help converting to vb.net