Home All Groups Group Topic Archive Search About

** is this posible in VB6 ?? **

Author
19 Oct 2005 5:50 PM
farmer
Hello,


I made a small program that needs to be scheduled to run every night.
On some ocasions however the program must be used manualy to e.g.
change the settings of for what ever reason. For this purpose the
program has a graphical interface.


The question

Can I make a VB program with a startup parameter ??

e.g.

start.exe /A   the program runs in the background
start.exe /B   the program starts with the gui



Any idea's ???

Greetings

Farmer

Author
19 Oct 2005 5:59 PM
Jim Edgar
Show quote Hide quote
"farmer" <antwer***@hotmail.vom> wrote in message
news:081dl1htt3ccfdhn7h4t8sji297amrlotc@4ax.com...
> Hello,
>
>
> I made a small program that needs to be scheduled to run every night.
> On some ocasions however the program must be used manualy to e.g.
> change the settings of for what ever reason. For this purpose the
> program has a graphical interface.
>
>
> The question
>
> Can I make a VB program with a startup parameter ??
>
> e.g.
>
> start.exe /A   the program runs in the background
> start.exe /B   the program starts with the gui
>
>
>
> Any idea's ???
>
> Greetings
>
> Farmer

Look up the Command() function.  It returns the command line parameters
which must then be parsed by your program.

Jim Edgar
Author
19 Oct 2005 6:08 PM
Someone
You could use the following code to get the command line options using the
Command Function. It only supports the space and Tab as separators. You can
expand it if needed.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vafctcommandx.asp

Or just press F1 in VB6 while the cursor is on "Command" and click on
Example...

> I made a small program that needs to be scheduled to run every night.

You could use Task Scheduler to run your shortcut.


Show quoteHide quote
"farmer" <antwer***@hotmail.vom> wrote in message
news:081dl1htt3ccfdhn7h4t8sji297amrlotc@4ax.com...
> Hello,
>
>
> I made a small program that needs to be scheduled to run every night.
> On some ocasions however the program must be used manualy to e.g.
> change the settings of for what ever reason. For this purpose the
> program has a graphical interface.
>
>
> The question
>
> Can I make a VB program with a startup parameter ??
>
> e.g.
>
> start.exe /A   the program runs in the background
> start.exe /B   the program starts with the gui
>
>
>
> Any idea's ???
>
> Greetings
>
> Farmer
>
>
>
>
>
>
>
>
>
Author
19 Oct 2005 6:13 PM
Kjell
To pass arguments to your application you can use "Command"

I'm not exactly all possibillities but I know it works fine when using Sub
Main() for starting an application, I assume it should work with Form_load
too.

"Command" is like a default variable that you can check at startup, ex.

If Command = "A" then

else

endif

Regards

Kjell

Show quoteHide quote
"farmer" wrote:

> Hello,
>
>
> I made a small program that needs to be scheduled to run every night.
> On some ocasions however the program must be used manualy to e.g.
> change the settings of for what ever reason. For this purpose the
> program has a graphical interface.
>
>
> The question
>
> Can I make a VB program with a startup parameter ??
>
> e.g.
>
> start.exe /A   the program runs in the background
> start.exe /B   the program starts with the gui
>
>
>
> Any idea's ???
>
> Greetings
>
> Farmer
>
>

>
>
>
>
>
>
>
Author
19 Oct 2005 6:43 PM
farmer
Hello everyone,


Thanks a milion for your tips and advice

Works great,

Greetings Farmer
Author
19 Oct 2005 8:42 PM
MikeD
"farmer" <antwer***@hotmail.vom> wrote in message
news:081dl1htt3ccfdhn7h4t8sji297amrlotc@4ax.com...
> Hello,
>
>
> I made a small program that needs to be scheduled to run every night.
> On some ocasions however the program must be used manualy to e.g.
> change the settings of for what ever reason.

You've gotten the help you need in regards to command line parameters.

I want to offer an additional comment/opinion.....

Instead of having your app constantly running in the background for no real
reason (other than to kick off what it must do presumably only once per
night), use Task Scheduler to schedule your app to run at a certain time
every night. If you do that, your app doesn't need to be always running just
so that it can constantly be checking the time to see when it should perform
this nightly task.

If it were me, I'd have the program start with the GUI if there are no
command line parameters.  When set up in Task scheduler, include a command
line parameter so the program knows to just "do its thing and quit".

--
Mike
Microsoft MVP Visual Basic