Главная страница | назад





Article #22617: TPrinterSetupDialog Access Violation

Question:
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?

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

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

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

Last Modified: 20-NOV-00