
Listing Valid Drives and Drive Types
Quote:
> How do I get Clarion to return a list of the valid drives on the computer
> and whether they are Local, Network or CD-Roms?
Module('Windows API')
!used by pathsetup to see if drive is valid
OMIT('***',_WIDTH32_)
GetDriveType( SIGNED),ushort,Pascal
***
COMPILE('***',_WIDTH32_)
GetDriveType(*cstring),UNSIGNED,PASCAL,RAW,NAME('GetDriveTypeA')
***
DRIVE_FIXED EQUATE( 3 )
DRIVE_REMOVABLE Equate( 2 )
DRIVE_REMOTE EQUATE( 1 )
DRIVE_CD EQUATE( 4 )
DriveQ QUEUE,PRE()
DQ:Drive STRING(1)
DQ:IconNumber LONG
DQ:DriveType USHORT
END
!16 bit version
?listdrives{prop:iconlist,1}='~cd16.ico'
?listdrives{prop:iconlist,2}='~disk16.ico'
?listdrives{prop:iconlist,3}='~dsket16.ico'
?listdrives{prop:iconlist,4}='~netwk16.ico'
?listdrives{prop:iconlist,5}='~ram.ico'
?Listdirs{prop:iconlist,1}='~fldrclsd.ico'
?Listdirs{prop:iconlist,2}='~fldropen.ico'
Drives STRING('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
DriveType USHORT
loop I# = 1 to 26 !Get available drives
DriveType = GetDriveType(I# - 1)
if DriveType
DQ:Drive = Drives[ I# ]
case drivetype
of drive_fixed
DQ:iconnumber=2
of drive_removable
dq:iconnumber=3
of drive_remote
dq:iconnumber=4
of drive_CD
dq:iconnumber=1
else
dq:iconnumber=5
.
DQ:DriveType = DriveType !Add to Drive list
add(DriveQ)
.
.
---
Jim Kane - TeamTopSpeed
Productive Software Solutions
Can't Find that Message?
Get Organized, Get ForKeeps!
www.fkeeps.com