I am writing a standard windows app in Delphi 7.
If I was writing a console app, I can call the following to output to the cmd line or output file.
write
I'm not quite sure what you are trying to achieve.
As I understood the question one way could be
program Project1;
{$APPTYPE CONSOLE}
uses
Forms, Classes, Windows,
Unit1 in 'Unit1.pas' { Form1 } ;
{$R *.res}
var
Finished: Boolean;
Input: String;
function IsConsoleMode(): Boolean;
var
SI: TStartupInfo;
begin
SI.cb := SizeOf(TStartupInfo);
GetStartupInfo(SI);
Result := ((SI.dwFlags and STARTF_USESHOWWINDOW) = 0);
end;
procedure HandleInput;
begin
Finished := Input = 'quit';
if not Finished then
begin
Writeln('Echo: ' + Input);
end
else
Writeln('Bye');
end;
begin
if IsConsoleMode then
begin
Finished := false;
Writeln('Welcome to console mode');
while not Finished do
begin
readln(Input);
HandleInput;
end;
end
else
begin
Writeln('Entering GUI Mode');
FreeConsole;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end;
end.