Einzelnen Beitrag anzeigen

Benutzerbild von turboPASCAL
turboPASCAL

Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
 
Delphi 6 Personal
 
#5

Re: Bei einem Komandozeilenprogramm in der gleichen Spalte..

  Alt 23. Mai 2005, 10:49
Hi, eine Lösung gibt es nur noch auf Umwegen...

Delphi-Quellcode:
program Test;

{$APPTYPE CONSOLE}

uses Windows, SysUtils;

var
 ConHandle : THandle; // Handle to console window
 Coord : TCoord; // To store/set screen position
 MaxX, MaxY : Word; // To store max window size
 NOAW : LongInt;

//-----------------------------------------
// Get handle to console output
//-----------------------------------------
function GetConOutputHandle : THandle;
begin
  Result := GetStdHandle(STD_OUTPUT_HANDLE)
end;

//-----------------------------------------
// Position cursor to X, Y
//-----------------------------------------
procedure GotoXY(X, Y : Word);
begin
  Coord.X := X; Coord.Y := Y;
  SetConsoleCursorPosition(ConHandle, Coord);
end;
{
procedure Cls;
begin
  Coord.X := 0; Coord.Y := 0;
  FillConsoleOutputCharacter(ConHandle, ' ', MaxX * MaxY,  Coord,  NOAW);
  GotoXY(0, 0);
end
}

procedure Init;
begin
  // Get console output handle
  ConHandle := GetConOutputHandle;
  // Get max window size
  Coord := GetLargestConsoleWindowSize(ConHandle);
  MaxX := Coord.X;
  MaxY := Coord.Y;
end;

var i: byte;

begin
  // Initialize global variables
  Init;

  //Cls;

  Coord.X := 0; Coord.Y := 0;
  // Console Code Page API is not supported under Win95 - only GetConsoleCP
  Writeln('Console Code Page = ', GetConsoleCP);
  Writeln('Max X=', MaxX,' Max Y=', MaxY);
  Writeln('----------------------------------------------------');
  writeln;

  write('Teste... ');

  for i:=1 to 100 do
  begin
    gotoxy(12,4);
    write(i, ' %');
    sleep(100);
  end;
  writeln;
  writeln('press ENTER to close Prg.')
  Readln;
end.
Siehe auch URL: http://www.geocities.com/SiliconVall...6/con_apps.htm

MfG.
Matti
Meine Software-Projekte - Homepage - Grüße vom Rüsselmops -Mops Mopser
  Mit Zitat antworten Zitat