在一个工程中,只有一个Form窗体,怎样设置命令行参数!编释后,可传递参数!
请大侠指教!我知道PB中是在APPLICAT中OPEN事件CommandLine参数。

解决方案 »

  1.   

    用command()函数Function GetCommandLine(Optional MaxArgs)
    Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
    '检查是否提供了 MaxArgs参数。
    If IsMissing(MaxArgs) Then MaxArgs = 10
    ReDim ArgArray(MaxArgs) As String
    NumArgs = 0: InArg = False
    CmdLine = Command()
    CmdLnLen = Len(CmdLine)
    '以一次一个字符的方式取出命令行参数。
    For I = 1 To CmdLnLen
    C = Mid(CmdLine, I, 1)
    If (C < > " " And C < > vbTab) Then
    If Not InArg Then
    If NumArgs = MaxArgs Then Exit For
    NumArgs = NumArgs + 1
    InArg = True
    End If
    '将字符加到当前参数中。
    ArgArray(NumArgs) = ArgArray(NumArgs) + C
    Else
    InArg = False
    End If
    Next I
    ReDim Preserve ArgArray(NumArgs)
    GetCommandLine = ArgArray()
    End Function调用方式如下:
    Dim cmdarray As Variant
    Rem cmdarray = GetCommandLine()