KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Hiding the console window with LAUNCH EXTERNAL PROCESS
PRODUCT: 4D | VERSION: 2004.1 | PLATFORM: Mac & Win
Published On: March 24, 2005

In 4D 2004, the command LAUNCH EXTERNAL PROCESS was introduced. This command allows applications to be executed in a separate process.

On Windows, a black console window would appear when executing a console-based application with the command. In 2004.1, the command SET ENVIRONMENT VARIABLE has been updated to allow the console window to be hidden from view.

To hide a console window you could execute the following code:

SET ENVIRONMENT VARIABLE("_4D_OPTION_HIDE_CONSOLE";"True")
LAUNCH EXTERNAL PROCESS("dir.exe";$input;$output)

Now the console window is suppressed and hidden from view. To have it appear again, simply run LAUNCH EXTERNAL PROCESS without SET ENVIRONMENT VARIABLE or set the parameter to "False."

Commented by Cannon Smith on October 23, 2009 at 3:05 PM
Note that this command must be called before every LAUNCH EXTERNAL COMMAND, even with several in a row, for it to work.