Показать сообщение отдельно
  #2  
Старый 04.09.2011, 13:56
Аватар для v1s2222
v1s2222 v1s2222 вне форума
Продвинутый
 
Регистрация: 07.09.2010
Сообщения: 726
Репутация: 26711
По умолчанию

http://codingworld.ru/showthread.php?p=4828
Код:
program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Windows,
  Unit1 in 'Unit1.pas';

var
  imax : integer = 100;
  inow : string  = '';
  psi : integer;
begin
  Writeln('This is the test with GotoXY');
  Writeln('Progress: 0%');
  for psi := 0 to imax do
  begin
    GotoXY(10, 1);
    write(IntToStr(psi) + '%');
    Sleep(100);
  end;
  Readln;
end.

unit Unit1;

interface

procedure SetAttr(attr: word);
function GetAttr: word;
procedure GotoXY(aX, aY: integer); { zero-based coords }
function WhereX: integer;
function WhereY: integer;

implementation

uses Windows;

var
  UpperLeft: TCoord = (X:0; Y:0);
  hCon: integer;

procedure GotoXY(aX, aY: integer);
var
  aCoord: TCoord;
begin
  aCoord.x:=aX;
  aCoord.y:=aY;
  SetConsoleCursorPosition(hCon,aCoord);
end;

procedure SetAttr(attr: word);
begin
  SetConsoleTextAttribute(hCon,attr);
end;

function WhereX: integer;
var
  ScrBufInfo: TConsoleScreenBufferInfo;
begin
  GetConsoleScreenBufferInfo(hCon,ScrBufInfo);
  Result:=ScrBufInfo.dwCursorPosition.x;
end;

function WhereY: integer;
var
  ScrBufInfo: TConsoleScreenBufferInfo;
begin
  GetConsoleScreenBufferInfo(hCon,ScrBufInfo);
  Result:=ScrBufInfo.dwCursorPosition.y;
end;

function GetAttr: word;
var
  ScrBufInfo: TConsoleScreenBufferInfo;
begin
  GetConsoleScreenBufferInfo(hCon,ScrBufInfo);
  Result:=ScrBufInfo.wAttributes;
end;

initialization
  hCon := GetStdHandle(STD_OUTPUT_HANDLE);

end.
Это?
__________________
Помогаю за Спасибо
Ответить с цитированием