Click here to Skip to main content
15,906,816 members
Articles / Desktop Programming / MFC
Article

Change Partition/Drive Name and Colored Progress Control

Rate me:
Please Sign up or sign in to vote.
1.86/5 (8 votes)
14 Jun 2004CPOL2 min read 59K   1.9K   10   6
The article lets you to change the partition/drive name which Windows 2000, NT and Windows XP have assigned. It also includes code for colored Progress Controls.

Sample Image - ChangeDriveName.jpg

IMPORTANT

This article holds information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, view the "Restoring the Registry" Help topic in Regedit.exe.

Introduction

The utility lets you to change the drive name which Windows 2000, NT and Windows XP have assigned. Although one can change the drive letter by editing registry, inappropriate change made in the registry may lead you to reinstalling the OS!!! This program safely changes the drive letter, though some safety precautions must be handled.

The utility also includes colored progress control which totally changes the traditional appearance of progress bar.

Users Manual

In order to execute the program, we have to select the existing drive letter and the drive letter to which we need to change. Then click “Apply” button to apply new settings. After applying settings, the message box is popped out requesting to restart the computer. We can restart the computer later by selecting “No” from the message box. The Progress button invokes the progress bar color change module and it does not changes any settings in the Registry.

Safety Precautions

In this program, we can’t change the drive letter “c:”, cause the OS loads many software referring the path “C:\ProgramFiles\.....” from the registry; so if we change the drive letter which contains the installed software, we will be unable to execute the software.

The setting changed needs to restart the computer in order to take effect, so, save all the files before you execute it, though you can restart later by selecting “No” from the message box.

Change Drive Name Module

The changes have been made on the HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices. The volume partition data is first copied to a dummy variable and another value name is created with the new drive letter, and the data is copied to the value. Eventually, the first drive value name is deleted.

The partition table, a 64-byte data structure used to identify the type and location of partitions on a hard disk, conforms to a standard layout independent of the operating system. When the OS analyses the partition using the partition volume data, the drive name we have changed comes in contact, then the OS changes the drive letter to the corresponding partition table data.

  • The documentation is included in the source code for better understanding.
  • To execute the module successfully, login user must have administrator privileges.

Change Progress Bar Color Module

The progress bar shown here serves for dummy purpose. The traditional progress bar color has been changed. We can apply almost all colors to our progress bar control. This is archived by ::SendMessage command.

The COLORREF, lParam values can be changed to have other colors. Similarly the value of COLORREF can be constantly varied to have a smooth effect on the progress control.

License

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


Written By
Web Developer
India India
Sheik Abdullah is B-Tech grad from Crescent Engineering College, Madras University, Chennai, India.

His current assignments is BioInformatics R&D software. He is familiar with DICOM which includes 2D image procesing. He programs VC++, COM and ATL for Software Gaint in BioInformatics based in Bangalore, India.

His hobbies include programming in VC++, hunting hidden treasures of Windows OS and computer games.

Comments and Discussions

 
QuestionI also want to change drive name. Pin
Phiru1-Dec-11 18:29
Phiru1-Dec-11 18:29 
QuestionHow to change drive letter without reboot the system Pin
anujkawasthi24-Jan-11 21:55
anujkawasthi24-Jan-11 21:55 
AnswerRe: How to change drive letter without reboot the system Pin
KS200814-Nov-11 19:41
KS200814-Nov-11 19:41 
GeneralNice Article Pin
near2world28-Jun-07 3:47
near2world28-Jun-07 3:47 
QuestionCHange the VolumeName is Possible? Pin
kiranin23-Nov-06 19:55
kiranin23-Nov-06 19:55 
Can we change the Volume Name Programatically?
For example we have NEW VOLUME( F: ) I want change this as KIRAN( F: ) Programatically?
Is it possible ,if how we change?
AnswerRe: CHange the VolumeName is Possible? Pin
ayanami_rei9-Jul-07 20:59
ayanami_rei9-Jul-07 20:59 

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.