Hi all,
I'm really a newbie.
How can I trap (read in my program) the parameters which where giving at the
launch of the my program?
thanks for any tips
Danny
Raoul Watson - 30 Dec 2004 12:02 GMT
> Hi all,
>
[quoted text clipped - 4 lines]
> thanks for any tips
> Danny
You can use the "command" function
(parameterstring = command)
To test it in the VB environment, you can go to the Project Properties under
the "Make" tab and set the argument there.
If you type command and get help on it, there is a good example
Danny De Koster - 30 Dec 2004 13:04 GMT
Raoul,
What I want to achieve is receiving a variable that has been send when I
launch my program.
ex.: c:\foto\foto.exe filename.bmp
I want to know the filename that has been given.
> > Hi all,
> >
[quoted text clipped - 11 lines]
> the "Make" tab and set the argument there.
> If you type command and get help on it, there is a good example
Raoul Watson - 30 Dec 2004 13:58 GMT
> Raoul,
>
[quoted text clipped - 4 lines]
>
> I want to know the filename that has been given.
That is *exactly* what command will give you. *Whatever* parameters were
passed. For example:
c:\program files\program.exe /picture.bmp, sound.wav
will return "/picture.bmp, sound.wav"
Danny De Koster - 30 Dec 2004 14:21 GMT
indead. it works. Thank you very much Raoul.
> > Raoul,
> >
[quoted text clipped - 11 lines]
>
> will return "/picture.bmp, sound.wav"
LG - 31 Dec 2004 02:50 GMT
Here is a snippet of code I wrote to handle command line switches that might
help:
--snip--
If IDEMode = True Then
strCommand = "-d -t10"
Else
strCommand = Command
End If
strCmdArray = Split(strCommand, " ")
For intLoop = 0 To UBound(strCmdArray)
strCommand = strCmdArray(intLoop)
Select Case Left(strCommand, 2)
Case "-t"
If Val(Mid(strCommand, 3)) < 10 Or Val(Mid(strCommand, 3)) >
60 Then GoTo CmdError
tmrPing.Interval = Val(Mid(strCommand, 3)) * 1000
Case "-d"
blnDebug = True
Case "-?"
GoTo CmdError
Case Else
GoTo CmdError
End Select
Next
--snip--
As you can see, it allows for multiple command switches. This can be
improved of course, and IIRC I do have a rather advanced one somewhere, this
was just the one I found first.
Cheers
G