- Код: Выделить всё
Private Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As Long
Private Declare Function lStrLen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (pDst As Any, pSrc As Any, ByVal ByteLen As Long)
Private Function GetCommandListStr() As String
Dim lngRString As Long, lngRStrLen As Long, astrBuffer As String
lngRString = GetCommandLine()
lngRStrLen = lStrLen(lngRString)
If (lngRStrLen > 0) Then
GetCommandListStr = Space$(lngRStrLen)
CopyMemory ByVal GetCommandListStr, ByVal lngRString, lngRStrLen
End If
End Function
Вопрос в том, что GetCommandLine всегда первым делом возвращает строку с путем/именем исполняемого файла, так и должно быть?

ЗЫ:
MSDN по этому поводу как-то неоднозначно выражается
Note The name of the executable in the command line that the operating system provides to a process is not necessarily identical to that in the command line that the calling process gives to the CreateProcess function. The operating system may prepend a fully qualified path to an executable name that is provided without a fully qualified path.