[Windows] Get Drive Type

Share your advanced PureBasic knowledge/code with the community.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

[Windows] Get Drive Type

Post by BackupUser »

Code updated for 5.20+

Restored from previous forum. Originally posted by wayne1.

Code: Select all

;for PB Windows Version
;RETRIEVE DRIVE TYPE

Type = GetDriveType_("c:\")

Select type
                                                   
  Case #DRIVE_UNKNOWN;  The drive type cannot be determined. 
   MessageRequester("Drive Type","Unknown", 0) 

  Case #DRIVE_NO_ROOT_DIR ;The root path is invalid. For example, no volume is mounted at the path. 
   MessageRequester("Drive Type","The root path is invalid. For example, no volume is mounted at the path.", 0) 

  Case #DRIVE_REMOVABLE ;The disk can be removed from the drive.
   MessageRequester("Drive Type","Removable", 0) 

  Case #DRIVE_FIXED; The disk cannot be removed from the drive.
    MessageRequester("Drive Type","Fixed", 0) 

  Case #DRIVE_REMOTE ;The drive is a remote (network) drive. 
    MessageRequester("Drive Type"," remote (network)", 0) 

  Case #DRIVE_CDROM ;The drive is a CD-ROM drive. 
    MessageRequester("Drive Type","CD-ROM drive", 0)
     
  Case #DRIVE_RAMDISK ; The drive is a RAM disk.
    MessageRequester("Drive Type","RAM disc", 0)

EndSelect
Edited by - wayne1 on 10 July 2001 03:06:40