CDTray
弹出或关闭光驱托盘.
CDTray ( "drive", "status" )
参数
drive
|
光驱盘符, 格式为 D:, E:, 等等.
|
status
|
指定光驱托盘的弹出或关闭:
$CDTRAY_OPEN ("open") - 弹出
$CDTRAY_CLOSED ("closed") - 关闭光盘托盘 (非笔记本光驱)
常量定义在 AutoItConstants.au3
|
返回值
成功:
|
返回 1.
|
失败:
|
返回 0, 表示指定驱动器已被 CD 刻录软件锁定或该盘符并非光驱.
|
备注
CDTray() 也能用于控制如 DAEMON Tools 的虚拟光驱.
CDTray() 不能用于控制非本地/映射的光驱; CDTray() 只能运行在能实际控制光驱的电脑上.
CDTray("X:", "close") 对只能手动关闭的笔记本光驱返回 1.
函数示例
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
; Get List of all CDRom's
Local $aCDRom = DriveGetDrive($DT_CDROM)
If @error Then
MsgBox($MB_SYSTEMMODAL, "", "No CDRom found.")
Exit
EndIf
; Open the CD tray of the first CDRom
CDTray($aCDRom[1], $CDTRAY_OPEN)
Sleep(2000)
CDTray($aCDRom[1], $CDTRAY_CLOSED) ; does not work on laptop-style cd trays that can only be closed manually.
----------------------------------------
该函数可以通过命令调用 exect
参见:
DriveGetType, DriveStatus
exect=CDTray('F:','open') ;;打开CD驱动器托盘F:
© Аверин Андрей для Total Commander Image Averin-And@yandex.ru
|