Modify ↓
#2762 closed Feature Request (Completed)
Example proposal - _WinAPI_GetDriveType.au3
| Reported by: | mLipok | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | Documentation | |
| Version: | Severity: | None | |
| Keywords: | Cc: |
Description
Source:
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <APIFilesConstants.au3>
Example_WinAPI_GetDriveType()
Func Example_WinAPI_GetDriveType()
Local $iTypeOfDrive = _WinAPI_GetDriveType("C:")
If $iTypeOfDrive = $DRIVE_UNKNOWN Or $iTypeOfDrive = $DRIVE_NO_ROOT_DIR Then
MsgBox($MB_SYSTEMMODAL, "Failure", "The path is invalid or the type cannot be determined")
EndIf
Switch $iTypeOfDrive
; Case $DRIVE_UNKNOWN
; ConsoleWrite("The drive type cannot be determined." & @LF)
; Case $DRIVE_NO_ROOT_DIR
; ConsoleWrite("The root path is invalid; for example, there is no volume mounted at the specified path." & @LF)
Case $DRIVE_REMOVABLE
ConsoleWrite("The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader." & @LF)
Case $DRIVE_FIXED
ConsoleWrite("The drive has fixed media; for example, a hard disk drive or flash drive." & @LF)
Case $DRIVE_REMOTE
ConsoleWrite("The drive is a remote (network) drive." & @LF)
Case $DRIVE_CDROM
ConsoleWrite("The drive is a CD-ROM drive." & @LF)
Case $DRIVE_RAMDISK
ConsoleWrite("The drive is a RAM disk." & @LF)
EndSwitch
Return $iTypeOfDrive
EndFunc ;==>Example_WinAPI_GetDriveType
Attachments (1)
Change History (14)
by , 12 years ago
| Attachment: | _WinAPI_GetDriveType.au3 added |
|---|
follow-up: 3 comment:1 by , 12 years ago
follow-up: 9 comment:4 by , 12 years ago
| Resolution: | → Completed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.

ConsoleWrite() shouldn't be used in the examples as not everyone is using SciTE or something that captures the standard input output stream. You also have a message box to display an error but then proceed to display the consolewrite lines regardless.