Skip to content

Latest commit

 

History

History
57 lines (44 loc) · 1.34 KB

sample_012.md

File metadata and controls

57 lines (44 loc) · 1.34 KB

Home

Displaying the drive type value

Before you begin:

See also:


Code:

#DEFINE DRIVE_UNKNOWN     0
#DEFINE DRIVE_NO_ROOT_DIR 1
#DEFINE DRIVE_REMOVABLE   2
#DEFINE DRIVE_FIXED       3
#DEFINE DRIVE_REMOTE      4
#DEFINE DRIVE_CDROM       5
#DEFINE DRIVE_RAMDISK     6

DECLARE INTEGER GetDriveType IN kernel32 STRING nDrive

DECLARE INTEGER RealDriveType IN shell32;
	INTEGER iDrive, INTEGER fOKToHitNet

LOCAL nIndex, nType

FOR nIndex=Asc("A") TO Asc("Z")

	* both functions return identical results
	nType = RealDriveType(nIndex-65, 0)
*	nType = GetDriveType(Chr(nIndex) + ":")

	DO CASE
	CASE nType = DRIVE_REMOVABLE
		? Chr(nIndex)+":", "removable"
	CASE nType = DRIVE_FIXED
		? Chr(nIndex)+":", "fixed"
	CASE nType = DRIVE_REMOTE
		? Chr(nIndex)+":", "remote"
	CASE nType = DRIVE_CDROM
		? Chr(nIndex)+":", "CDROM"
	CASE nType = DRIVE_RAMDISK
		? Chr(nIndex)+":", "RAM"
	ENDCASE
ENDFOR  

Listed functions:

GetDriveType
RealDriveType