我正在使用 .Net 开发计费应用程序。我需要使用 EPSON TM-T81 打印收据。我已经安装了所有必需的驱动程序和 MS POS v1.12。我可以通过 CheckHealth Utility 成功打印示例内容。所以看起来 PosPrinter 配置没有问题。但仍然 PosExplorer().getDevices 返回空值。我在 Windows 和 ASP.Net 应用程序中都尝试过,但仍然是同样的问题。代码:PosPrinter m_Printer = null;
//<<<step1>>>--Start
//Use a Logical Device Name which has been set on the SetupPOS.
string strLogicalName = "PosPrinter";
try
{
//Create PosExplorer
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
try
{
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter,strLogicalName);
m_Printer =(PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
catch(Exception)
{
ChangeButtonStatus();
return;
}
//Open the device
m_Printer.Open();
//Get the exclusive control right for the opened device.
//Then the device is disable from other application.
m_Printer.Claim(1000);
//Enable the device.
m_Printer.DeviceEnabled = true;
}
catch(PosControlException)
{
ChangeButtonStatus();
}
//<<<step1>>>--End