Skip to content

Instantly share code, notes, and snippets.

@Linda-chan
Last active December 1, 2019 22:56
Show Gist options
  • Select an option

  • Save Linda-chan/b5d71f338852a5039053848bc62e833b to your computer and use it in GitHub Desktop.

Select an option

Save Linda-chan/b5d71f338852a5039053848bc62e833b to your computer and use it in GitHub Desktop.
#include "windows.bi"
#include "win\shellapi.bi"
'====================================================================
Private Function MyCommand() As String
Dim lpCmdLine As LPSTR
Dim CmdLine As String
Dim RC As Integer
lpCmdLine = GetCommandLine()
If lstrlen(lpCmdLine) = 0 Then
MyCommand = ""
Exit Function
Else
CmdLine = String(lstrlen(lpCmdLine) + 1, 0)
lstrcpy CmdLine, lpCmdLine
End If
CmdLine = LTrim(CmdLine, Any !" \t\r\n")
If Left(CmdLine, 1) = """" Then
RC = InStr(2, CmdLine, """")
If RC = 0 Then
MyCommand = ""
Exit Function
End If
RC = RC + 2
Else
RC = InStr(CmdLine, " ")
If RC = 0 Then
MyCommand = ""
Exit Function
End If
RC = RC + 1
End If
MyCommand = Mid(CmdLine, RC)
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment