Quote Originally Posted by Bonnie West View Post
The PathIsRelative(Command$) = True test will fail if PathIsRelative returns TRUE because 1& = -1% is False.
I changed it like this:
Code:
Call SendData(hWndPrevInstance, IIf(PathIsRelative(Command$) = 1&, CurDir & "\", vbNullString) & Command$)
that should work, right? Ok, it doesn't: see the image below and tell me where I mistake
Name:  DOS SHELL.jpg
Views: 1068
Size:  76.4 KB
Use a MsgBox to see what Command$ contains.

Quote Originally Posted by Bonnie West View Post
Parsing the command line is no easy task. If your program is an MDI application, then I assume that your app accepts multiple input files at once through the command line.
The project started within this purpose, but (fortunately at this time xD) for tecnical reasons I have forsaken this feature, even though I still need a MDI application.

Quote Originally Posted by Bonnie West View Post
The code you showed provides no means for the first instance to know whether the passed command line contains the current directory of the second instance or not. You could either, always include the current directory as the first path in the command line, or you could define a command line switch that indicates the presence of the current directory.
That is, I should do this:
Code:
Public Sub Main()
    If Is2ndInstance() Then
        Call SendData(hWndPrevInst, Command$)
        Exit Sub
    Else
        Call Form1.Show
    End If
End Sub

Private Sub Form_Initialize()
    Call Subclass(Me)
End Sub

Private Sub Form_Load()
    If PathIsRelative(Command$) = 1& Then
        myCommand = CurDir$ & "\" & Command$
    End If
    Open myCommand For Input As #1
    'etc etc
End Sub
right?