QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: IronMan on March 30, 2020, 01:04:15 pm
-
I have a small QB64 application, and I am needing to be able to run it in a hidden state. I would like to be able to pass a command line option to it like " application.exe -h", the -h meaning HIDE. I'm needing the application to run normally but with no screen writes.
I have done this using the SHELL _HIDE to hide windows from viewing things being ran with shell, but I need it to hide the entire application. The application does have text output to the screen when ran, but need the ability to run it with or without screen output.
Any help or information is greatly appreciated.
Thank you.
-Kent
-
Try _SCREENHIDE
-
With _SCREENHIDE the QB64 exe icon will also be hidden from the taskbar. You will need to us _SCREENSHOW somewhere in the program to get it, and the program window back; otherwise, you might have to use Task Manager, if running in Windows, to terminate the application if your app runs in a loop waiting for some kind of response. There are also metacommands, $SCREENHIDE and $SCREENSHOW. https://www.qb64.org/wiki/$SCREENSHOW
I would recommend reading up on these statements by checking out the link, and the associated links to the other _SCREEN... statements, above before messing with this command.
Pete
-
Pete
Thanks for the info.
So how would you pass a command line option to the program to enable $SCREENHIDE?
Looking to do something like "application.exe -h" to make it run in hidden mode, otherwise it would run normal if no command line option is used.
Thanks.
-Kent
-
Got it working... That was far more easier than I was thinking..
IF COMMAND$ = "-h" THEN
_SCREENHIDE
ELSE
END IF
I have tested with and without the -h command option and it works perfect.
Thanks.
-Kent
-
I may have spoken to soon.
Although when I use the code at the beginning of my app,
IF COMMAND$ = "-h" THEN
_SCREENHIDE
ELSE
END IF
It does stop the program from running in the foreground. However the first time you run it, it still shows the WINDOW.
After it's runs for the first time, it no longer show the window. Anyone have any ideas on this?
Thank you.
-Kent
-
$SCREENHIDE
IF COMMAND$ = "-h" THEN 'the screen is hidden by default
ELSE
_SCREENSHOW 'and we unhide it if the "-h" flag is absent
END IF
-
$SCREENHIDE
IF COMMAND$ = "-h" THEN 'the screen is hidden by default
ELSE
_SCREENSHOW 'and we unhide it if the "-h" flag is absent
END IF
Yea, that's what I'm doing and it works good. However, is there a way to not show the Window? I need a way to make it run completely hidden.
Thanks.
-Kent