🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.program
Article #317

Re: VB��ô��ȡ�����в��������ģ���

#317
From: Angus Chan
Date: Sat, 08 Aug 1998 00:00
50 lines
2516 bytes
[From Visual Basic Books Online]

This example uses the Command function to get the command line 
arguments in a function that returns them in a Variant 
containing an array. 

Function GetCommandLine(Optional MaxArgs)
        'Declare variables.
        Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
        'See if MaxArgs was provided.
        If IsMissing(MaxArgs) Then MaxArgs = 10
        'Make array of the correct size.
        ReDim ArgArray(MaxArgs)
        NumArgs = 0: InArg = False
        'Get command line arguments.
        CmdLine = Command()
        CmdLnLen = Len(CmdLine)
        'Go thru command line one character
        'at a time.
        For I = 1 To CmdLnLen
                C = Mid(CmdLine, I, 1)
                'Test for space or tab.
                If (C <> " " And C <> vbTab) Then
                        'Neither space nor tab.
                        'Test if already in argument.
                        If Not InArg Then
                        'New argument begins.
                        'Test for too many arguments.
                                If NumArgs = MaxArgs Then Exit For
                                NumArgs = NumArgs + 1
                                InArg = True
                        End If
                        'Concatenate character to current argument.
                        ArgArray(NumArgs) = ArgArray(NumArgs) & C
                Else
                        'Found a space or tab.
                        'Set InArg flag to False.
                        InArg = False
                End If
        Next I
        'Resize array just enough to hold arguments.
        ReDim Preserve ArgArray(NumArgs)
        'Return Array in Function name.
        GetCommandLine = ArgArray()
End Function



--
�� ��Դ:���������� BBS bbs.nease.net��[FROM: earth.glink.net]
Technical Details
Message-ID: <3Q1HPJ$T57@bbs.nease.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: fc86e,6ec1ea5e1e9fc713,start
X-Google-Attributes: gidfc86e,public
From: angus.bbs@bbs.nease.net (Angus Chan)
Subject: Re: VB��ô��ȡ�����в��������ģ���
Date: 1998/08/08
Message-ID: <3Q1HPJ$T57@bbs.nease.net>
X-Deja-AN: 379143643
X-Filename: Program/M.902581699.A
X-Complaints-To: usenet@news.nease.net
X-Trace: news.nease.net 902582093 3284 202.96.152.195 (8 Aug 1998 13:14:53 GMT)
Organization: Net Ease
NNTP-Posting-Date: 8 Aug 1998 13:14:53 GMT
Newsgroups: cn.bbs.comp.program,