已解决了!!呵呵!!谢谢大家了!!
这里两种都可以的!!
[bo]
一个按钮的方法:[/bo]
Option Explicit
Private Declare Function CDdoor Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim state1 As Boolean
Private Sub Command1_Click()
If Not state1 Then
'打开光驱
state1 = True
Call CDdoor("set CDAudio door open", 0, 0, 0)
Command1.Caption = "关闭"
Else
'关闭光驱
state1 = False
Call CDdoor("set CDAudio door closed", 0, 0, 0)
Command1.Caption = "打开"
End If
End Sub
[bo]
还有就是:两个按钮的[/bo]
Option Explicit
Private Declare Function CDdoor Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Dim state1 As Boolean
Private Sub Command1_Click()
'关闭光驱
Command1.Visible = False
Command2.Visible = True
Call CDdoor("set CDAudio door closed", 0, 0, 0)
End Sub
Private Sub Command2_Click()
'打开光驱
Command2.Visible = False
Command1.Visible = True
Call CDdoor("set CDAudio door open", 0, 0, 0)
End Sub
[bo]
这是用VB6.0中文企业版,XP台式机下运行成功的![/bo]
这里真好啊!!学到了很多了!真的很感谢大家!!
[[it] 本帖最后由 yujimin 于 2008-4-9 12:37 编辑 [/it]]