Click or drag to resize

DiskChange Function

X#
Change the current disk drive.

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

Parameters

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

Return Value

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