Usually when you want to get the argument portion of the command line you use the intrinsic Command$() function.
But that function is not supporting unicode. In order to supply your .exe with a unicode command line it is necessary to use the "GetCommandLineW" and "PathGetArgsW" API.
But that function is not supporting unicode. In order to supply your .exe with a unicode command line it is necessary to use the "GetCommandLineW" and "PathGetArgsW" API.
Code:
Option Explicit
Private Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineW" () As Long
Private Declare Function PathGetArgs Lib "shlwapi" Alias "PathGetArgsW" (ByVal lpszPath As Long) As Long
Private Declare Function SysReAllocString Lib "oleaut32" (ByVal pbString As Long, ByVal pszStrPtr As Long) As Long
' (VB-Overwrite)
Public Function Command() As String
If InIDE() = False Then
SysReAllocString VarPtr(Command), PathGetArgs(GetCommandLine())
Command = LTrim$(Command)
Else
Command = VBA.Command$()
End If
End Function
Public Function InIDE(Optional ByRef B As Boolean = True) As Boolean
If B = True Then Debug.Assert Not InIDE(InIDE) Else B = True
End Function