3个回答
展开全部
给你做个简单的介绍吧,先做下面的
'添加窗体Form1,然后添加如下代码:
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
Private Sub Form_Load()
Select Case Left(Command, 2)
Case "/o" '表示open,打开光驱
mciSendString "Set CDAudio Door Open Wait", 0&, 0&, 0&
Case "/c" '表示close,关闭光驱
mciSendString "Set CDAudio Door Closed Wait", 0&, 0&, 0&
End Select
Unload Me
End Sub
将上面的编译成test.exe,放到c:\下,然后打开命令提示符窗口,敲入c:\test.exe /o看看,是不是打开光驱了?再试试c:\test.exe /c
'添加窗体Form1,然后添加如下代码:
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
Private Sub Form_Load()
Select Case Left(Command, 2)
Case "/o" '表示open,打开光驱
mciSendString "Set CDAudio Door Open Wait", 0&, 0&, 0&
Case "/c" '表示close,关闭光驱
mciSendString "Set CDAudio Door Closed Wait", 0&, 0&, 0&
End Select
Unload Me
End Sub
将上面的编译成test.exe,放到c:\下,然后打开命令提示符窗口,敲入c:\test.exe /o看看,是不是打开光驱了?再试试c:\test.exe /c
展开全部
Private Sub Form_Load()
if Command<>"" then Msgbox Command 'Command就是命令行参数
End Sub
if Command<>"" then Msgbox Command 'Command就是命令行参数
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Command函数返回命令行参数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询