C# POS for.Net无法检测打印机
我正在为我的一个项目使用POS for.Net framework 1.12版 Microsoft POS for.NET是一个类库,它是Microsoft Windows Embedded for Point of Service的一部分。 上面是查找打印机的示例代码。现在我的问题是POS无法检测打印机,而只能在我运行应用程序时打开带有数据的模拟器C# POS for.Net无法检测打印机,c#,asp.net,winforms,pos-for-.net,C#,Asp.net,Winforms,Pos For .net,我正在为我的一个项目使用POS for.Net framework 1.12版 Microsoft POS for.NET是一个类库,它是Microsoft Windows Embedded for Point of Service的一部分。 上面是查找打印机的示例代码。现在我的问题是POS无法检测打印机,而只能在我运行应用程序时打开带有数据的模拟器 有人能帮我吗 我已经为运行Windows CE作为操作系统的POS开发了一个应用程序,但对于该POS,制造商提供了一个自定义dll,用于调用我在
有人能帮我吗 我已经为运行Windows CE作为操作系统的POS开发了一个应用程序,但对于该POS,制造商提供了一个自定义dll,用于调用我在C#代码中使用的打印机操作。请与POS制造商联系,看看他们是否提供了相同的自定义dll。您的代码行
DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter);
将返回找到的默认值或第一个PosPrinter,在您的情况下,它看起来像是模拟器
您需要(1)遍历打印机集合,并以某种方式选择所需的打印机。i、 e
foreach (DeviceInfo deviceInfo in explorer.GetDevices(DeviceType.PosPrinter))
{
if (isThisThePrinterIWant(deviceInfo)) // user defined function (maybe lookup saved preference file)
{
return (PosPrinter)posExplorer.CreateInstance(deviceInfo );
}
} // Note: GetDevices() not GetDevice()
或(2)为打印机设置一个逻辑名称(使用打印机附带的软件,或Pos for.Net SDK附带的POSDM实用程序),并将上述行更改为
DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter, "madeUpLogicalName");
或(3)只需将所需打印机设置为默认打印机,并保持代码不变。是否将打印机详细信息(LDN)添加到配置文件中??
DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter, "madeUpLogicalName");