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)
Changed 10 years ago by mLipok
comment:1 follow-up: ↓ 3 Changed 10 years ago by guinness
comment:2 follow-up: ↓ 7 Changed 10 years ago by anonymous
1
comment:3 in reply to: ↑ 1 ; follow-up: ↓ 6 Changed 10 years ago by anonymous
1
comment:4 follow-up: ↓ 9 Changed 10 years ago by guinness
- Resolution set to Completed
- Status changed from new to closed
comment:5 in reply to: ↑ description ; follow-up: ↓ 8 Changed 10 years ago by anonymous
1
comment:6 in reply to: ↑ 3 ; follow-up: ↓ 10 Changed 10 years ago by anonymous
1
comment:7 in reply to: ↑ 2 ; follow-up: ↓ 12 Changed 10 years ago by anonymous
1
comment:8 in reply to: ↑ 5 Changed 10 years ago by anonymous
1
comment:9 in reply to: ↑ 4 ; follow-up: ↓ 11 Changed 10 years ago by anonymous
1
comment:10 in reply to: ↑ 6 Changed 10 years ago by anonymous
1
comment:11 in reply to: ↑ 9 Changed 10 years ago by anonymous
1
comment:12 in reply to: ↑ 7 ; follow-up: ↓ 13 Changed 10 years ago by anonymous
1
comment:13 in reply to: ↑ 12 Changed 10 years ago by anonymous
1
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
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.