June 13, 2024, 12:21:05 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Accepting Command Line Arguments?

Started by tekrat, September 28, 2007, 03:05:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tekrat

Hey all,

I can't find in the documentation how to accept a command line argument. What I mean is something like this:

  myProgram.exe -this -that

All I want to do is have a file load when click on it that I've associate with a filetype (like .txt).

Many thanks in advance!

Johnny

September 29, 2007, 02:18:26 PM #1 Last Edit: September 29, 2007, 02:41:38 PM by Johnny
Hello to all,

Once I was also looking for the same feature, and found a solution in an API call.
With this sample code you can get the whole commandline, then you have to separate the things you want from it...

With kind regards,
Johnny

PS: Allways enjoying all your posts!
And I'm an absolute fan of Paul's fantastic software!!!   :)

DECLARE "kernel32",Sleep(dwMilliseconds:INT)
DECLARE "kernel32",GetCommandLineA(),STRING
DEF TempString : STRING
OPENCONSOLE

TempString = GetCommandLineA():'Get the Command Line String
Print TempString
Print

Print "Press the Any Key to close this window"
DO
    Sleep(100):'Just to prevent keeping the processor busy for 100%...with doing nothing...
UNTIL INKEY$ <> ""
CLOSECONSOLE
END