Registriert seit: 18. Mai 2003
634 Beiträge
|
WriteConsoleOutput
17. Jun 2004, 16:01
Hi ihrs
Ich schaffe es leider nicht mit diesem Code eine Ausgabe zu erstellen.
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
CH: THandle;
p:pointer;
CI: array[0..10,0..10]of CHAR_INFO;
x,y: COORD;
z: SMALL_RECT;
i,j:integer;
begin
for i:=low(ci) to high(ci)do
for j:=low(ci[i]) to high(ci[i])do
begin
ci[i,j].UnicodeChar:='A';
ci[i,j].Attributes:=FOREGROUND_BLUE;
ci[i,j].AsciiChar:='A';
end;
CH:=0;
p:=AllocMem(sizeof(TSecurityAttributes));
PSECURITYATTRIBUTES(p).nLength:=sizeof(TSecurityAttributes);
PSECURITYATTRIBUTES(p).lpSecurityDescriptor:=nil;
PSECURITYATTRIBUTES(p).bInheritHandle:=true;
AllocConsole;
SetConsoleTitle('Hallo');
CH:=CreateConsoleScreenBuffer(GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, p, CONSOLE_TEXTMODE_BUFFER, nil);
x.X:=high(ci)-low(ci);
x.Y:=high(ci[high(ci)])-low(ci[high(ci)]);
y.X:=0;
y.Y:=0;
z.Left:=low(CI);
z.Top:=low(CI[low(CI)]);
z.Right:=high(CI);
z.Bottom:=high(CI[low(CI)]);
WriteConsoleOutput(CH,@ci,x,y,z);
ShowMessage(inttostr(GetLastError()));
end;
Wo liegt der Fehler?
|
|
Zitat
|