 |
| Retrieving list of available disk drives |
User rating: 0/10 (0 votes) | | |
|
 |
 |
Versions: click to open |
 |
|
 |
 |
| Before you begin: |
 |
Find removable, fixed, CD-ROM, RAM disk, and network drives available on the local system.
See also:
Disconnecting USB Mass Storage Device programmatically
Mapping and disconnecting network drives in FoxPro application
Enumerating network resources
Enumerating Volumes and Volume Mounting Points (NTFS)
Disk in drive A:
|
 |
 |
DECLARE INTEGER GetLogicalDrives IN kernel32
DECLARE INTEGER GetDriveType IN kernel32 STRING nDrive
LOCAL nDrivesMask, nIndex, nShift, cDrive
nDrivesMask = GetLogicalDrives()
? "Available disk drives:"
nIndex = 0
DO WHILE .T.
nShift = BitLShift(1, nIndex)
cDrive = Chr(nIndex + 65) + ":"
IF BitAnd(nDrivesMask, nShift) = nShift
? cDrive, GetDriveType(cDrive)
ENDIF
IF nShift > nDrivesMask
EXIT
ENDIF
nIndex = nIndex + 1
ENDDO
|
 |
User rating: 0/10 (0 votes) | | | 468 bytes Created: 2001-07-12 12:00:00 Modified: 2009-03-16 20:16:28 Visits in 7 days: 37 |
|
 |
 |
| Listed functions: |
 |
|
 |
 |
| My comment: |
 |
| DriveType: 0 Unknown
1 No Root Directory
2 Removable Disk
3 Local Disk
4 Network Drive
5 Compact Disc
6 RAM Disk
Related VFP functions: DRIVETYPE(), SYS(5), DISKSPACE(). |
 |
 |
| Word Index links for this example: |
 |
|
|
 |
 |
| Translate this page: |
 |
|