$APPTYPE : Specify type of application (Win32 and AmigaOS only)

The {$APPTYPE XXX} accepts one argument that can have two possible values: GUI or CONSOLE. It is used to tell the WINDOWS Operating system if an application is a console application or a graphical application. By default, a program compiled by Free Pascal is a console application. Running it will display a console window. Specifying the {$APPTYPE GUI} directive will mark the application as a graphical application; no console window will be opened when the application is run. If run from the command-line, the command prompt will be returned immediatly after the application was started.

Care should be taken when compiling GUI applications; the Input and Output files are not available in a GUI application, and attempting to read from or write to them will result in a run-time error.

It is possible to determine the application type of a WINDOWS or AMIGA application at runtime. The IsConsole constant, declared in the Win32 and Amiga system units as

 Const
   IsConsole : Boolean
contains True if the application is a console application, False if the application is a GUI application.