Click or drag to resize

DiskChange Function

X#
Change the current disk drive.

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

Parameters

pszDrive
Type: String
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