Ohne laestiges Alloziieren:
Delphi-Quellcode:
type
LPGETTEXTEX = ^GETTEXTEX;
GETTEXTEX = record
cb: DWORD;
flags: DWORD;
codepage: UINT;
lpDefaultChar: LPCSTR;
lpUsedDefaultChar: LPBOOL;
end;
// [...]
var
tex: GETTEXTEX;
pc: array [0..4095] of Char;
begin
tex.cb := SizeOf(pc);
tex.flags := GT_USECRLF;
tex.codepage := CP_ACP;
tex.lpDefaultChar := nil;
tex.lpUsedDefaultChar := nil;
SendMessage(controlHandle, EM_GETTEXTEX, WPARAM(@tex), LPARAM(@pc[0]));
DoSomethingWithResult(pc);
end;