比如有的程序运行时 程序名.exe 参数
这样运行,这怎么用vb做呢?

解决方案 »

  1.   

    一个例子:
    Option Explicit
    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 LongSub Main()
        Dim s As String
        s = Command
        If s = "/opendoor" Then
           mciSendString "set cdaudio door open", vbNullString, 0, 0
        ElseIf s = "/closedoor" Then
           mciSendString "set cdaudio door closed", vbNullString, 0, 0
        End If
        End
    End Sub
      

  2.   

    用Command
    Private Sub Form_Load()
     MsgBox Command
    End Sub
    在命令行下运行编译的程序:C:\> project1.exe "hello" 可以看到效果