Listing+drives+and+types

//by Michael Hicks, May 2007//

The Microsoft Windows API function "GetLogicalDriveStrings" enables a user to determine what drives are connected to a computer. The function "GetDriveType" enables the user to determine the type of the drive. The following is an example of the use of these functions.

code format="bb4w" SYS "GetLogicalDriveStrings", 0, 0 TO buffsize% DIM dstring% buffsize% SYS "GetLogicalDriveStrings", buffsize%, dstring% PRINT "List of drives" PRINT "==============" ' i% = dstring% WHILE ?i% a$ = $$i% i% += LEN(a$)+1 SYS "GetDriveType", a$ TO p%       CASE p% OF          WHEN 0: t$="UNKNOWN" WHEN 1: t$="No root directory - this is an error" WHEN 2: t$="REMOVABLE" WHEN 3: t$="FIXED" WHEN 4: t$="REMOTE" WHEN 5: t$="CD/DVD" WHEN 6: t$="RAM DISK" OTHERWISE: t$="?" ENDCASE PRINT a$,t$ ENDWHILE code