Registriert seit: 23. Jul 2005
71 Beiträge
Delphi 10 Seattle Professional
|
Re: Event verursacht Riched32.dll Exception
31. Okt 2009, 14:58
Hi,
ich konnte mein Problem inzwischen selber lösen.
Delphi-Quellcode:
const
WMWriteLog = WM_USER + 101;
type
TForm1 = class(TForm)
procedure ReadWMWriteLog(var Msg: TMessage);
message WMWriteLog;
...
private
{ Private declarations }
public
{ Public declarations }
end;
procedure TForm1.AddLog(s: String);
var
wParam: Word;
begin
wParam := GlobalAddAtom(PChar(s));
PostMessage(Self.Handle, WMWriteLog, wParam, 0);
end;
procedure TForm1.ReadWMWriteLog(var Msg: TMessage);
var
Buffer: PChar;
s: string;
begin
Buffer := nil;
try
s := '';
GetMem(Buffer, 255);
if GlobalGetAtomName(Msg.wParam, Buffer, 255) > 0 then
s := StrPas(Buffer);
Log.SelStart := Log.GetTextLen;
Log.SelText := '[' + TimeToStr(Time) + '] ' + s + #13 + #10;
finally
GlobalDeleteAtom(Msg.wParam);
FreeMem(Buffer);
end;
end;
Gruss Alois
|
|
Zitat
|