【VB6笔记-02】从Command中获取链接参数

时间:2022-03-29 15:03:10
Public Sub GetParameters()
Dim Para As String Para = Command$()
gstrUserID = GetCommandPara(Para, )
gstrDSN = GetCommandPara(Para, )
gstrSQLUserID = GetCommandPara(Para, )
gstrPassWord = GetCommandPara(Para, )
gstrServerName = GetCommandPara(Para, )
gstrDataBaseName = GetCommandPara(Para, )
gstrCompanyCode = GetCommandPara(Para, ) gblnAllowAdd = IIf(UCase(GetCommandPara(Para, )) = "Y", True, False)
gblnAllowEdit = IIf(UCase(GetCommandPara(Para, )) = "Y", True, False)
gblnAllowDelete = IIf(UCase(GetCommandPara(Para, )) = "Y", True, False)
gblnAllowSpecial = IIf(UCase(GetCommandPara(Para, )) = "Y", True, False)
End Sub Public Function GetCommandPara(CommandStr As String, ParaNum As Integer) As String #If c_IssueVersion Then
On Error GoTo GetCommandPara_Err
#End If Dim OrigCmdStr As String
Dim i As Integer
Dim j As Integer
ReDim PosArray( To ) OrigCmdStr = RTrim$(LTrim$(CommandStr))
PosArray() =
j = For i = To Len(OrigCmdStr)
If Mid$(OrigCmdStr, i, ) = "~" Then
PosArray(j) = i
j = j +
End If
Next i PosArray(j) = Len(OrigCmdStr) +
GetCommandPara = Mid$(OrigCmdStr, PosArray(ParaNum - ) + , PosArray(ParaNum) - PosArray(ParaNum - ) - ) Exit Function
GetCommandPara_Err:
Call ErrHandler("The application can not get information to Login Server!", "Load Form")
End Function