API是吧。有点复杂了。
以下函数在XP SP3下测试成功。。。
如果光驱门按钮坏了,是可经弹出,但是不会关闭的。郁闷。
我的光驱就是如此。哈哈。。。
_CdTray("g:","Open")
;打开光驱
_CdTray("g:","CLosed")
;关闭光驱
Func _CdTray($Drive,$flags)
;Autoit 中文论坛版权所有
DllCall("winmm.dll", "int", "mciSendString", "str", "Open " & $Drive & " Alias Drive" & $Drive & " Type CDAudio", "int", 0, "int", 0, "int", 0)
Switch $flags
Case "Open"
DllCall("winmm.dll", "int", "mciSendString", "str", "Set Drive" & $Drive & " Door Open", "int", 0, "int", 0, "int", 0)
Case "CLosed"
DllCall("winmm.dll", "int", "mciSendString", "str", "Set Drive" & $Drive & " Door Closed", "int", 0, "int", 0, "int", 0)
EndSwitch
EndFunc
|