Refreshing printers

Hi,


I've found that once my program is already running, changing the name of a printer in Windows and then trying to print to it results in an Exception when using TfrxReport

(EInvalidOperation) Canvas does not allow drawing.

In my specific instance, the first time this happens, it causes this exception, and then on each subsequent time it happens, my program then puts up an alert window saying "Printer selected is not valid" which then hangs until acknowledged and then throws the same Exception as above. This is a problem, as the code is being deployed as a windows service application, so the alert window is hidden, and the service freezes.

Is there a way to refresh the Printer list before I generate each report?

Also - is there a way to force these popup alert windows to raise exceptions instead? I've already tried setting TfrxReport.EngineOptions.SilentMode:=True, and TfrxReport.EngineOptions.NewSilentMode=simSilent, and TfrxReport.EngineOptions.NewSilentMode=simReThrow. None make a difference.


Thanks in advance,

Griffyn

Comments

  • I've managed a workaround for my issue which works only because, fortunately, TfrxReport throws an exception the first time without the popup window.

    So I catch the EInvalidOperation exception and in the exception handler call frxPrinters.FillPrinters; (must add frxPrinter to the uses clause) which fixes the problem on the next attempt to print to that printer. This avoids the popup windows in this case.

    However, it would still be nice to know how to suppress all popup alert windows entirely. Any suggestions are welcome.

  • Create small demo project with error and send it to support@fast-report.com

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.