User Tools

Site Tools


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$="?"
          PRINT a$,t$
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
listing_20drives_20and_20types.txt · Last modified: 2018/04/17 17:48 by tbest3112