From: Sergei Soudakov (boss@uniqum.tomsk.su) Subject: GetPrinter problem Newsgroups: borland.public.delphi.vcl.components.using Date: 2000/05/25 Hi all, Does anybody know how to cure... I need to determine if there is a default printer in the system (before to work with TQuickRep descendants). There is a known piece of code recommended by QSoft guys (to chek default printer presence) with calling Printer.GetPrinter and checking DeviceName afterwards. But if there are no installed printers at all, the call Printer.GetPrinter raises an exception with message "Win32 error. Code123." It occurs with D4+SP2,3 under Win98. Under NT4 it runs correctly. AFAIK, it goes as following (in Printers unit): GetPrinter->GetPrinterIndex->SetToDefaultPrinter SetToDefaultPrinter calls WinAPI EnumPrinters(PRINTER_ENUM_DEFAULT,...) which returns False. That causes exception. But what I have to do with this? The questions are: 1. How to organize platform (Win32) -independent check of default printer presence. 2. Is it safe to use Printers.Count (and forget about GetPrinter). 3. Maybe there is another way ? 4. Or I should use old-fascioned : GetProfileString("windows", "device", ",,,", buffer, sizeof(buffer)) as adviced in MSDN (Article ID: Q135387 ) I need a solution for D4 (if it is VCL-specific). TIA ======================================================================= From: Paul Ferrara (paul@nospam.columbusoft.com) Subject: Re: GetPrinter problem Newsgroups: borland.public.delphi.vcl.components.using Date: 2000/05/25 Did you check to see if Printer.Printers is an empty stringlist? That would tell you if there are any printers. IME, if any printers exist, one is always the default. Paul / ColumbuSoft www.columbusoft.com