RAD Studio (Common)
ContentsIndex
PreviousUpNext
Application type (Delphi)
Type  
Parameter  
Syntax  
{$APPTYPE GUI} or {$APPTYPE CONSOLE}  
Default  
{$APPTYPE GUI}  
Scope  
Global  

Remarks 

This directive is used in Delphi Windows programming only. 

The $APPTYPE directive controls whether to generate a Win32 console or graphical user interface application. 

In the {$APPTYPE GUI} state, the compiler generates a graphical user interface application. This is the normal state for a Delphi application. 

In the {$APPTYPE CONSOLE} state (equivalent to the /CC command-line option), the compiler generates a console application. When a console application is started, the Input and Output standard text files are automatically associated with the console window. 

Setting {$APPTYPE CONSOLE} can be convenient for debugging as it allows you to use WriteLn statements in your program without having to explicitly open an output file. 

The IsConsole Boolean variable declared in the System unit can be used to detect whether a program is running as a console or graphical user interface application. 

The $APPTYPE directive is meaningful only in a program. It should not be used in a library, unit, or package.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!