请参看下面的代码:
procedure TForm1 . Button1Click ( Sender : TObject );
var
s : string ;
begin
AllocConsole ;
try
Write ( 'Type here your words and press ENTER: ' );
Readln ( s );
ShowMessage ( Format ( 'You typed: "%s"' , [ s ]));
finally
FreeConsole ;
end ;
end ;