» frame | home browse filter search | refresh | log on
printed zaterdag 25 mei 2013 23:13:51 from www.yoy.be
modified: 26/01/2012 19:46:40 by:
Printer.Canvas is not threadsafe!
No prior changes found, comparing to current content.
What a strange discovery I made today. I was hunting down a weird exception we noticed in the logs of the live system.
It turns out that a 'global' callback procedure is being called when you use Printer.Canvas (Printer.Canvas.StretchDraw in my case) by the GDI subsystem. The default AbortProc in Printers.pas calls Application.ProcessMessages, which was causing trouble in my case.
There's a quick workaround:
function MyAbortProc(Prn: HDC; Error: Integer): Bool; stdcall; begin Result := not FPrinter.Aborted; end;
And then right after
No changes found