ccommandline.cls

来自「一个简易的c++的编辑器」· CLS 代码 · 共 52 行

CLS
52
字号
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "CCommandLine"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
'分析命令参数
'鬼龙之舞
'2005-03-20
Private m_CommandLine As New Collection
Private Sub Class_Initialize()
    Dim s As String, s2 As String, sp() As String, i&, p1&, p2&, b As Boolean
    Dim l As Long
    s = Command$
    s2 = Trim(s)
    l = Len(s)
    For i = 1 To l
        If Asc(s2) = &H22 Then
            p1 = 2
            p2 = InStr(2, s2, """")
        Else
            p1 = 1
            p2 = InStr(1, s2, " ")
        End If
        If p2 = 0 Then
            m_CommandLine.Add s2
            Exit Sub
        Else
            m_CommandLine.Add Mid(s2, p1, p2 - p1)
        End If
        i = p2 + 1
        s2 = Trim(Mid(s2, i))
        If s2 = "" Then Exit Sub
   Next
End Sub
Public Property Get Item(ByVal index As Long) As String
    Item = m_CommandLine(index)
End Property

Public Property Get Count() As Long
    Count = m_CommandLine.Count
End Property

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?