docs

Home All functions Categories

vuStartDriveEnum()

vuStartDriveEnum(), LONG

Description

Begins a drive enumeration session.
Call this first, then loop with vuGetNextDrive, and finally call vuEndDriveEnum to clean up.

Parameters

Parameter Data Type Description
None   This function takes no parameters

Returns

Example

! Three-call drive enumeration:
!   1) vuStartDriveEnum()
!   2) vuGetNextDrive(ADDRESS(sRootPath), ADDRESS(dwDriveType)) in a loop
!   3) vuEndDriveEnum()

sRootPath   CSTRING(4)   ! e.g., 'C:\'
dwDriveType LONG
Result      LONG
sType       CSTRING(20)
Msg         CSTRING(100)

  CODE
  CLEAR(sRootPath)
  CLEAR(dwDriveType)

  Result = vuStartDriveEnum()
  IF Result = 0
    MESSAGE('Failed to start drive enumeration.')
    RETURN
  END

  LOOP
    Result = vuGetNextDrive(ADDRESS(sRootPath), ADDRESS(dwDriveType))
    IF Result = 0
      BREAK   ! no more drives
    END

    CASE dwDriveType
    OF 2  ; sType = 'Removable'
    OF 3  ; sType = 'Fixed'
    OF 4  ; sType = 'Network'
    OF 5  ; sType = 'CD/DVD'
    OF 6  ; sType = 'RAM Disk'
    ELSE  ; sType = 'Unknown'
    END

    Msg = 'Drive: ' & CLIP(sRootPath) & '  Type: ' & sType
    MESSAGE(Msg)
  END

  Result = vuEndDriveEnum()

Notes

Home All functions Categories