March 2000
Intermediate to advanced
576 pages
18h 13m
English
IsConsole Variable
var IsConsole: Boolean;
Delphi sets IsConsole to True in a console
application or False in a GUI application. You can test
IsConsole before trying to read from
Input or write to
Output.
// Report an error.
procedure ErrorHandler(Code: Integer; Addr: Pointer);
var
ErrorMessage: string;
begin
ErrorMessage := Format('Error %d at $%p', [Code, Addr]);
if IsConsole then
WriteLn(ErrorMessage)
else
ShowMessage(ErrorMessage);
Halt(Code);
end;| Input Variable, Output Variable, $AppType Compiler Directive |
Read now
Unlock full access