User Tools

Site Tools


listing_20drives_20and_20types

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.

        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
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
listing_20drives_20and_20types.txt · Last modified: 2024/01/05 00:22 by 127.0.0.1