设备弹出媒介.
#Include <WinAPIEx.au3>
_WinAPI_EjectMedia ( $sDrive )
$sDrive | 弹出 CD 托盘架的驱动器号,如 D:, E:, 等等. |
成功: | 返回 1. |
失败: | 返回 0,设置@error标志为非 0 值. |
在MSDN中搜索
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Drive = DriveGetDrive('CDROM')
If IsArray($Drive) Then
ConsoleWrite('Open...' & @CR)
_WinAPI_EjectMedia($Drive[1])
ConsoleWrite('Tray is open: ' & _WinAPI_IsDoorOpen($Drive[1]) & @CR)
Sleep(1000)
ConsoleWrite('Close...' & @CR)
_WinAPI_LoadMedia($Drive[1])
ConsoleWrite('Tray is open: ' & _WinAPI_IsDoorOpen($Drive[1]) & @CR)
EndIf