Delphi中的Dos问题----很急(100分)

  • 主题发起人 主题发起人 胡萝卜
  • 开始时间 开始时间

胡萝卜

Unregistered / Unconfirmed
GUEST, unregistred user!
各位DFW:<br><br>&nbsp; &nbsp; &nbsp; 我现在需要做一个校验程序----即在Dos下运行的程序.用户要求清屏,请问用Delphi如何清屏.
 
ClrScr<br>或<br>winexec('cmd /c cls',sw_hide);
 
&gt;&gt;TYZhang:<br><br>可能你理解错了,<br>我要的是用在CONSOLE程序里的DOS程序界面清屏的方法。
 
&gt;&gt;TYZhang:<br><br>&nbsp; &nbsp; 请问使用“ClrScr”需引用哪个Unit?我在帮助中找不到。<br>&nbsp; &nbsp; 我试了一下“winexec('cmd /c cls',sw_hide);”,它不适合我的需要。因为它把后面输出的界面也给清除了。
 
1,'cmd /c cls'是DOS下面的命令。
 
procedure ClearScreen; //清屏<br>var sbi: TConsoleScreenBufferInfo;<br>&nbsp; &nbsp; h: hwnd;<br>&nbsp; &nbsp; Cord: _COORD;<br>&nbsp; &nbsp; R: Cardinal;<br>begin<br>&nbsp; h := GetStdHandle(STD_OUTPUT_HANDLE);<br>&nbsp; GetConsoleScreenBufferInfo(h, sbi);<br>&nbsp; Cord.X := 0;<br>&nbsp; Cord.Y := 0;<br>&nbsp; FillConsoleOutputCharacter(h, ' ', sbi.dwSize.X * sbi.dwSize.Y, Cord, R);<br>&nbsp; SetConsoleCursorPosition(h, Cord);<br>end;<br><br>begin<br>&nbsp; writeln('Press Enter to Clear &nbsp;then Screen');<br>&nbsp; writeln('Press Enter to Clear &nbsp;then Screen');<br>&nbsp; writeln('Press Enter to Clear &nbsp;then Screen');<br>&nbsp; writeln('Press Enter to Clear &nbsp;then Screen');<br>&nbsp; writeln('Press Enter to Clear &nbsp;then Screen');<br>&nbsp; Readln;<br>&nbsp; //ClearConsoleScreen;<br>&nbsp; ClearScreen;<br>&nbsp; writeln('ffffffffffffffff');<br>&nbsp; Readln;<br>end.
 
后退
顶部