I registered my own exception-handler and I want to take a screenshot and save it to disk, before showing the exception.
I tried this with
Code: Select all
...
screen := TFileStream.Create( 'test.png', fmCreate );
try
WriteToStreamRaw( screen, CreateScreenShotPng( st256Colors ) );
finally
screen.Free;
end;
...
Code: Select all
procedure WriteToStreamRaw(Stream: TStream; Text: string);
var
Len: integer;
buf: PChar;
begin
with Stream do
begin
Len := length(text);
buf := StrAlloc(Len+1);
StrPCopy(buf, Text);
WriteBuffer(buf^, Len);
StrDispose(buf);
end;
end;
I'm using madExcept 2.7c. What am I doing wrong??
thx,
Tom.