If there are multiple spaces in the command line, like -f myfile then the code in the tutorial doesn't work, because it treats each space as a token.
In Gary Cornell's VB6 book, he implements what he calls a SuperTrim, which iteratively replaces each spacespace with just a space until there is none left.
Here it is:
VB Code:
Public Function SuperTrim(TheString As String) As String
'Gary Cornell p356
Dim Temp As String
Dim DoubleSpaces As String
DoubleSpaces = Chr(32) & Chr(32)
Temp = Trim(TheString)
Temp = Replace(Temp, DoubleSpaces, Chr(32))
Do Until InStr(Temp, DoubleSpaces) = 0
Temp = Replace(Temp, DoubleSpaces, Chr(32))
Loop
SuperTrim = Temp
End Function
and then change the code in the tutorial thusly:
VB Code:
a_strArgs = Split(SuperTrim(Command$), " ")
'supertrim the command string before splitting it