С возвращением! Я сразу с вопросом - допустим, процедура:
procedure Delete;
var
Console:Handle;
Dummy:PSecurity_Attributes;
begin
Dummy:=nil; //этот способ я взял с freepascal.ru , если ставить непосредственно в функцию - компилятор
//ругаеццо
AllocConsole;
Console:=CreateConsoleScreenBuffer(GENERIC_READ+GENERIC_WRITE,
0,Dummy^,CONSOLE_TEXTMODE_BUFFER,nil);
SetConsoleActiveScreenBuffer(Console);
write('Некий текст');
readkey;
FreeConsole;
end;
А какие модули юзаешь?
procedure Delete;
var
h, Std_In : Handle;
foo: ^SECURITY_ATTRIBUTES;
procedure ConWrite(s : string);
var i, j, l: longint;
begin
l := system.length(s);
i := 1;
repeat
WriteConsole(h, @s[i], l, @j, nil);
dec(l, j); inc(i, j);
until l = 0;
end;
function ConRead: string;
var
i, j, l: longword;
s: string;
ir: INPUT_RECORD;
begin
repeat
repeat
ReadConsoleInput(Std_In, ir, 1, j);
until ir.EventType = KEY_EVENT;
until ir.Event.KeyEvent.bKeyDown;
ConRead := ir.Event.KeyEvent.AsciiChar;
end;
var
s: string;
begin
if allocconsole() then begin
foo := nil;
h := CreateConsoleScreenBuffer(GENERIC_READ or GENERIC_WRITE,
0, foo^, CONSOLE_TEXTMODE_BUFFER, nil);
if h <> INVALID_HANDLE_VALUE then begin
SetConsoleActiveScreenBuffer(h);
Std_In := GetStdHandle(STD_INPUT_HANDLE);
ConWrite('Some Text.'#13#10);
repeat
s := ConRead;
ConWrite(s);
until s = #13;
end;
freeconsole();
end;
end;
Спасибо.
2Bokul: по ходу, дело не в модулях