I have a small console app. I want to hide its window when it is called from my main program (with -hide as command line parameter) and show it when the user starts it (no command line param).
This question suggests that using {$APPTYPE GUI} instead of {$APPTYPE CONSOLE} will hide the window. And indeed it works. But how do I make the window visible when ran by user?
Purpose: I want my main program to interact with the console app silently in the background (console is invisible). So, when the user starts the console app alone, I just want to give him a warning: 'This console app is doing x task. You cannot start it manually'.
CreateProcess
to do so, passing the CREATE_NO_WINDOW
flag. That flag ensures that no console window will be created.