关闭hp打印机 cd
大家好,
这是用于打开和关闭CD TRAY的简单方法。
请发表评论!
'add this lines of code in the declaration section of a standard module.
'---------------
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpszCommand As String, ByVal lpszReturnString As String, _
ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
'--------------
'Now in the module also declare this
'-----------------------------------
Sub opencd()
Call mciSendString("set CDAudio door open", 0, 0, 0)
End Sub
Sub closecd()
Call mciSendString("set CDAudio door closed", 0, 0, 0)
End Sub
'-----------------------------------
'Now add two command buttons to the form ( its obvious what i have taken below)
'-----------------------------------
Private Sub Command1_Click()
Call Module1.opencd
End Sub
Private Sub Command2_Click()
Call Module1.closecd
End Sub
'----------------------------------
问候
>> ALI <<
翻译自: https://bytes.com/topic/visual-basic/insights/774983-opening-closing-cd-tray
关闭hp打印机 cd