本文整理自网络,侵删。
//清屏 调用:ClearConsoleScreen; 即可 function ClearConsoleScreen: boolean;const BUFSIZE = 0*0;var Han,Dummy: LongWord; buf: string; coord: TCoord;begin Result := false; Han := GetStdHandle(STD_OUTPUT_HANDLE); if Han <> INVALID_HANDLE_VALUE then begin if SetConsoleTextAttribute(han, FOREGROUND_RED or FOREGROUND_GREEN or FOREGROUND_BLUE) then begin SetLength(buf,BUFSIZE); FillChar(buf[1],Length(buf),' '); if WriteConsole(han,PChar(buf),BUFSIZE,Dummy,nil) then begin coord.X := 0; coord.Y := 0; if SetConsoleCursorPosition(han,coord) then Result := true; end; end; end;end;
相关阅读 >>
Delphi7 中tstringlist的delimiter delimitedtext有bug,字符串分割有问题
更多相关阅读请进入《Delphi》频道 >>