简体   繁体   English

无法访问打印机Borland C ++ 5

[英]Can't access printer Borland C++ 5

I've recently moved from windows XP 32 bit to Windows 7 64 bit. 我最近从Windows XP 32位迁移到Windows 7 64位。 I can't access any printer in the Borland C++ 5 IDE. 我无法在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() 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. 如果我使用任何程序进行打印并打开打印机属性,则该问题将在IDE中消失,并且直到重新启动IDE时问题才恢复。 I've granted myself full access to all printers and I have full access to the directory Borland is installed to, c:\\borland. 我已授予自己对所有打印机的完全访问权限,并且对我将Borland安装到的目录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. 转到Devices and Printers ,然后查看您的其中一台打印机是否带有绿色的复选标记。 If not, right-click one and choose Set as default printer . 如果不是,请右键单击一个,然后选择“ Set as default printer

We are Delphi users and have the same problem. 我们是Delphi的用户,并且有相同的问题。

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. 问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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