CDrive class

This article was submitted .

The CDrive class is a small MFC class that wraps many of the Windows API functions dealing with Disk Drive information.

Get easy access to otherwise cumbersome APIs. Get the Disk Serial numbers and easy access to the dreaded ::GetDiskSpaceFreeEx() API. The class also wraps the drive network connections API, allowing you to connect and disconnect network drives.


CDriveVarious constructors.
SetCurrentDriveSets the drive.
SetDriveSets the drive.
SetNextFreeDriveSet the drive to the next avaiable entry.
SetFirstNetworkDriveSet the drive to the next network drive.
GetDrive(void)Returns the drive.
GetTypeReturns the drive type.
GetNameReturns the name (label) of the drive.
GetFileSystemNameReturns the File System name.
GetSerialNumberReturns the drive's Serial number.
GetComponentLengthReturns the drive's maximum path length.
GetAvailableSpaceReturns the free space available.
GetSectorsPerClusterReturns sections pr. clusers supported.
GetBytesPerSectorReturns bytes pr. sector supported.
GetNumberOfFreeClustersReturns available clusters.
GetTotalNumberOfClustersReturns total number of clusters on drive.
GetConnectionReturns the drive network connection string if any.
ConnectToConnects a network drive.
RemoveConnectionDisconnect network drive.
IsConnectedReturns success if the drive is a network drive.
HasLongFilenameSupportDoes drive support long filenames?
HasCompressionSupportDoes drive support compression?
IsCompressedIs drive compressed?
IsCaseSensitiveAre filenames case sensitive?

Source Code Dependencies

Microsoft MFC Library
My Global MFC functions

Download Files

DownloadSource Code (4 Kb)

To the top