Title: Add Console Input and Output for a GUI Delphi Application
If you want to have console input/output for GUI applications you should use the AllocConsole and FreeConsole functions.
The AllocConsole function allocates a new console for the calling process. The FreeConsole function detaches the calling process from its console. Here's the example:
var
s: string;
begin
AllocConsole;
try
Write('Type something and press [ENTER]') ;
Readln(s) ;
ShowMessage('You typed ' + s) ;
finally
FreeConsole;
end;
end;
Note: "pure" console applications are pure 32-bit Windows programs that run without a graphical interface. When a console application is started, Windows creates a text-mode console window through which the user can interact with the application.