Click or drag to resize

DiskChange Function

Change the current disk drive.

Namespace:  XSharp.RT
Assembly:  XSharp.RT (in XSharp.RT.dll) Version: 2.08
Syntax
 FUNCTION DiskChange(
	pszDrive AS PSZ
) AS LOGIC
View Source

Parameters

pszDrive
Type: Psz
The letter of the disk drive to change.

Return Value

Type: Boolean
TRUE if successful; otherwise, FALSE.
Remarks
Examples
This example uses DiskChange() to change to drive D:
X#
IF DiskChange("D:")
        ? "Successfully changed"
ELSE
        ? "Not changed"
ENDIF
This example builds a string that contains all currently available drives on your system:
X#
FUNCTION AllDrives()
        LOCAL wI AS DWORD
        LOCAL cDrives AS STRING
        cDrives := NULL_STRING
        FOR wI := 1 UPTO 27                                                          
                IF DiskChange(Chr(wI +64))
                        cDrives := cDrives + Chr(wI+64)
                ENDIF
        NEXT
        RETURN cDrives
See Also