palare98
asked on
Clear Screen in Delphi's Console Application
I am in a class learning Pascal. We are using the Console Application function of Delphi. In Turbo Pascal there was a built in function for clearing the screen. It was something like ClrScr. Is there something like this in Delphi? I'm not looking for some huge procedure to do this. I already have one of those.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try it an let you know. We have not gotten into API yet.
How'd you make out?
GL
Mike
GL
Mike
ASKER
I ended up getting what I needed from a dcu that was written by a guy that I know. I am going to give each of you points though.
Slick, I will write another question for you as soon as I get the chance.
Slick, I will write another question for you as soon as I get the chance.
Thanks, Glad you were able to get a solution.
GL
Mike
GL
Mike
program unins;
{$APPTYPE CONSOLE}
uses
Windows,
Messages,
SysUtils;
var
Str1: String;
hStdOut: HWnd;
ScreenBufInfo: TConsoleScreenBufferInfo;
Coord1: TCoord;
i: Integer;
begin
hStdOut := GetStdHandle(STD_OUTPUT_HA
Writeln('This is a test?');
Writeln('Does it work?');
ReadLn(Str1);
WriteLn('1 Ok we got anoter test line here');
WriteLn('2 Ok we got anoter test line here');
WriteLn('3 Ok we got anoter test line here');
WriteLn('4 Ok we got anoter test line here');
WriteLn('5 Ok we got anoter test line here');
WriteLn('6 Ok we got anoter test line here');
WriteLn('7 Ok we got anoter line here');
WriteLn('8 Ok we got anoter line here');
WriteLn('9 Ok we got anoter line here');
ReadLn(Str1);
// code for Clear Screen
GetConsoleScreenBufferInfo
{the GetConsoleScreenBufferInfo
the buffer I need}
for i := 1 to ScreenBufInfo.dwSize.Y do
WriteLn('');
Coord1.X := 0;
Coord1.Y := 0;
SetConsoleCursorPosition(h
{SetConsoleCursorPosition API sets your cursor
to the Coord1, at 0, 0 the beginging}
ReadLn(Str1);
end.
- - - - - - - - - - - - - - - - - - -
this works for me, but I don't use Console very much.
maybe you have not used any windows API yet. let me know