TPrinterSetupDialog Access Violation

By: CodeGear

Abstract: Workaround for TPrinterSetupDialog Access Violation

When running an application that contains TPrinterSetupDialog on a system that has no printers installed, starting the application may result in an Access Violation. Why does this happen, and how can I stop or prevent it?

Borland Technical Support has not been able to reproduce this error, so the cause remains unknown.

Test for the existence of a default printer using the following or similar code:

if (Printer()->Printers->Count)
// allow the copy
// insert default value here, instead of
// reading the non-existent default printer

Server Response from: ETNASC03