Function Reference


_WinAPI_IsDoorOpen

Checks if a CD (DVD) tray is open

#include <WinAPIFiles.au3>
_WinAPI_IsDoorOpen ( $sDrive )

Parameters

$sDrive The drive letter of the CD tray to check, in the format D:, E:, etc.

Return Value

Success: True - CD (DVD) tray is open.
False - Otherwise.
Failure: Sets the @error flag to non-zero.

See Also

Search IOCTL_SCSI_PASS_THROUGH in MSDN Library.

Example

#include <WinAPIFiles.au3>

Local $aDrive = DriveGetDrive('CDROM')

If IsArray($aDrive) Then
        ConsoleWrite('Open...' & @CRLF)
        _WinAPI_EjectMedia($aDrive[1])
        ConsoleWrite('Tray is open: ' & _WinAPI_IsDoorOpen($aDrive[1]) & @CRLF)
        Sleep(1000)
        ConsoleWrite('Close...' & @CRLF)
        _WinAPI_LoadMedia($aDrive[1])
        ConsoleWrite('Tray is open: ' & _WinAPI_IsDoorOpen($aDrive[1]) & @CRLF)
EndIf