Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

Forgot the Password?
Services
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
Programming
  Database
Automation
OS/Networking
Graphics
Links
Tools
» Regular Expr Tester
» Free Tools

Changing the icon of a drive
[ All Languages » VB »  Windows]

Total Hit ( 3114)

Rate this article:     Poor     Excellent 

 Submit Your Question/Comment about this article

Rating


 


By editing the Registry it is possible to change the icon that Windows Explorer uses for a drive. For example, if you want to change Drive E's icon, create the following registry key:

HEKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Explorer\DriveIcons\E\DefaultIcon\

When you create the above key, a string value named "Default" with value not set is automatically created. What you have to do is setting this value with the path of the icon, and this changes the drive icon of Drive E.

If you want revert back the default Icon, just delete the value of the "Default" string value, or just delete the above registry key. Here are two reusable routines to set or reset the icon for a specified drive:

Click here to copy the following block
Sub ChangeDriveIcon(ByVal driveLetter As String, ByVal icoPath As String)
  Dim regKey As String
  regKey = "Software\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\" & _
    driveLetter & "\DefaultIcon"
  
  ' create the parent key
  CreateRegistryKey HKEY_LOCAL_MACHINE, regKey
  ' set the (Default) value with the icon's path
  SetRegistryValue HKEY_LOCAL_MACHINE, regKey, "", icoPath
End Sub

Sub ResetDriveIcon(ByVal driveLetter As String)
  Dim regKey As String
  regKey = "Software\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\" & _
    driveLetter & "\DefaultIcon"
    
  ' delete the key
  DeleteRegistryKey HKEY_LOCAL_MACHINE, regKey
End Sub


Submitted By : Nayan Patel  (Member Since : 5/26/2004 12:23:06 PM)

Job Description : He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting.
View all (893) submissions by this author  (Birth Date : 7/14/1981 )


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.