Article ID: 291573 - Last Review: April 5, 2006 - Revision: 2.0 How To Use Visual Basic to List Active Logical DrivesThis article was previously published under Q291573 On This PageSUMMARY
You can determine which drive letters are in use on a local computer by using the GetLogicalDriveStrings Win32 API. This list of drive letters will be the drive letters of all active drives on the local computer, including floppy drives, hard disks, mapped drives, and other drives that are mapped to a drive letter.
MORE INFORMATION
The GetLogicalDriveStrings API function returns a string containing a list of all active drive letters on the local computer. The format of the string is a null-separated list of drive letters with a terminating null at the end of the string. For example, a computer with a single floppy drive (A:) and a single hard disk drive (C:) would have a string of the following format returned by GetLogicalDriveStrings:
A:\<null>C:\<null><null> The following Visual Basic code sample demonstrates how to retrieve and parse a list of drives. Note that this can also be used to create a control or feature similar to the DriveListBox. Step-by-Step Example
REFERENCESFor additional information, click the article numbers below
to view the articles in the Microsoft Knowledge Base:
190000
(http://support.microsoft.com/kb/190000/EN-US/
)
How To Get Started Programming with the Windows API
291575
(http://support.microsoft.com/kb/291575/EN-US/
)
How To Use Visual Basic to Locate CD-ROM Drives
196141
(http://support.microsoft.com/kb/196141/EN-US/
)
PRB: Problems Using Intrinsic File System Controls
The Visual Basic Programmer's Guide (available on MSDN Online, http://msdn.microsoft.com
(http://msdn.microsoft.com)
) | Article Translations
|
Back to the top
