{$APPTYPE CONSOLE}
program HelloWorld;
uses
windows,
Unit1 in 'Unit1.pas' {Form1};
var
hOutput: THandle;
sbiAttributes: TConsoleScreenBufferInfo;
wDefColors: WORD;
coorCurrent, coorTopLeft: TCoord;
sName:string;
const
FOREGROUND_BRCYAN = FOREGROUND_GREEN or
FOREGROUND_BLUE or FOREGROUND_INTENSITY;
begin
hOutput := GetStdHandle(STD_OUTPUT_HANDLE);
coorTopLeft.X := 1;
coorTopLeft.Y := 1;
{ 读缺省颜色 }
GetConsoleScreenBufferInfo(hOutput, sbiAttributes);
wDefColors := sbiAttributes.wAttributes;
coorCurrent := sbiAttributes.dwCursorPosition;
{ 把输出颜色改为亮青色,移动光标到屏幕顶部 }
SetConsoleTextAttribute(hOutput, FOREGROUND_BRCYAN);
SetConsoleCursorPosition(hOutput, coorTopLeft);
Writeln('退出按[e]键,继续请按[ENTER]键...');
Readln;
while sName <> 'e' do
begin
Writeln('请详细填写你的个人信息,个人信息格式如下:');
Writeln(' name:XXX ;sex:XXX;age:XXX;');
Readln(sName);
if sName='' then
begin
Writeln('您输入的个人信息是空!');
Readln;
end else
begin
Writeln('你输入的容是:'+sName);
Readln;
end;
end;
{ 恢复缺省颜色 }
SetConsoleTextAttribute(hOutput, wDefColors);
SetConsoleCursorPosition(hOutput, coorCurrent);
end.