Excel VBA高级编程:用VBA打开和关闭光驱

2015-04-13 14:10 阅读 119 次 评论关闭

*API函数声明如下:
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
注释:调用时的代码如下
Dim Ret As Long
Dim RetStr As String
注释:打开光驱
Ret = mciSendString("set CDAudio door open", RetStr, 0, 0)
注释:关闭光驱
Ret = mciSendString("set CDAudio door closed", RetStr, 0, 0)

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:Excel VBA高级编程:用VBA打开和关闭光驱 | 猎微网

评论已关闭!