I have a Service Application written in Delphi 6. I need to print a page to the default printer, but this has to be done in a thread.
Printer.Canvas.TextOut(x,y, 'My text to print');
This seems to be ok, but sometimes, printing stops. Exactly, the document is put into the print spooler's queue, but never printed out. If I delete the documents from the print queue it works again.
I think the problem is due the fact, the Canvas object is not thread-safe, so I've put it into synchronize like this:
The problem still exists. Delphi's help tells that, the method called with synchronize will be executed in the main VCL thread.
But I have not VCL thread, I have a service which is also a thread...
Moreover, I have no error message or exception at all...