简体   繁体   中英

Can't access printer Borland C++ 5

I've recently moved from windows XP 32 bit to Windows 7 64 bit. I can't access any printer in the Borland C++ 5 IDE. It seems like it's some sort of privileges problem because if I log in as an administrator the problem goes away. I have a simple one line program that shows the issue

PrintDialog1->Execute()

The dialog opens but if I press the properties button nothing happens. If I attempt to change any of the printer properties, ie page orientation etc, I get an message saying "Operation not supported on selected printer" and then several access violations.

Here's the weird bit. If I use any program to print something and open the printer properties, the problem goes away in the IDE and doesn't return until I restart the IDE. I've granted myself full access to all printers and I have full access to the directory Borland is installed to, c:\\borland.

Thanks in advance for any help.

This usually happens when there is no default printer assigned, or when there are no printers installed. As you've indicated that it works fine if you print from another application first (which means a current printer has been set), we know that you have a printer installed. This seems to indicate the problem is related to not having a default printer assigned.

Go to Devices and Printers , and see if one of your printers has a green check mark. If not, right-click one and choose Set as default printer .

We are Delphi users and have the same problem.

We solve this issue by setting the default printer as follows:

Printer.PrinterIndex := -1;

This is the unit Printers doc

unit Printers;
...
{  
  PrinterIndex - Specifies which printer in the TPrinters list that is
  currently selected for printing.  Setting this property to -1 will cause
  the default printer to be selected.  If this value is changed EndDoc is
  called automatically.
}

Hope it works for you. Regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM