我正在开发使用.Net的计费应用程序。我需要用爱普生TM-T81打印收据。我已安装所有必需的驱动程序和MS POS v1.12。我可以通过CheckHealth实用程序成功打印样本内容。所以看起来在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发布于 2015-04-16 21:28:09
如果这正是您试图运行的代码,那么问题是strLogicalName没有包含有效的SO或逻辑设备名。"PosPrinter“在代码示例中只是一个占位符(当然,除非您显式地设置了这样一个逻辑名称)。
要查找系统中可用的SO名称/逻辑设备名称,请使用以下命令:
"C:\Program Files (x86)\Microsoft Point Of Service\posdm.exe" listdevices /type:PosPrinter
"C:\Program Files (x86)\Microsoft Point Of Service\posdm.exe" listnames /type:PosPrinterhttps://stackoverflow.com/questions/25947558
复制相似问题