okeydokey,
do you start in Sub Main(), or in a Form_Load()? If it is the latter, I suggest you make your startup object Sub Main (Project menu -> Properties).
Then, you can parse the return value of Command$() in there.
That should work.VB Code:
' In a .bas module Private Declare Function PathFileExists Lib "shlwapi.dll" Alias "PathFileExistsW" ( _ ByVal pszPath As Long _ ) As Long Private Sub Main() Dim sFilename As String Dim sBuffer As String, hFile As Long sFilename = Trim$(Command$()) Load <MainFormName> If (PathFileExists(StrPtr(sFileName)) = 1) Then hFile = FreeFile() Open sFilename For Binary Lock Write As #hFile sBuffer = Space$(LOF(hFile)) Get #hFile, , sBuffer Close #hFile <MainFormName>.txtTestFile.Text = sBuffer End If <MainFormName.Show End Sub




Reply With Quote