首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不能声称PosPrinter

不能声称PosPrinter
EN

Stack Overflow用户
提问于 2014-03-15 23:19:47
回答 1查看 6.7K关注 0票数 4

我有一个TM-T20爱普生,我用这段代码试图打印:"Hello“消息,我一直在跟踪PosPrinter的一些礼仪:

代码语言:javascript
复制
public void ImprintHelloPrinter()
        {
            //The Explorer
            PosExplorer explorer = new PosExplorer();

            ////Get the device by its type LOGICAL NAME
            DeviceInfo device = explorer.GetDevice(DeviceType.PosPrinter, "T20PRINTER");

            //Create an instance
            PosPrinter oposPrinter = (PosPrinter)explorer.CreateInstance(device);

            //Opening 
            MessageBox.Show(@"Statue : " + oposPrinter.State.ToString());
            oposPrinter.Open();
            MessageBox.Show(@"Statue : " + oposPrinter.State.ToString());

            //Checking if its really the printer
            MessageBox.Show(@"Description : " + oposPrinter.DeviceDescription);


            MessageBox.Show(@"Check Claimed : " + oposPrinter.Claimed.ToString());
            oposPrinter.Claim(10000); //Here is My Exception 

            //Enabeling device
            oposPrinter.DeviceEnabled = true;

            //normal print
            oposPrinter.PrintNormal(PrinterStation.Receipt, "Hello Printer");
        }

一切都进行得很好,我检查了它是否是正确的打印机,并且打开了它,但当我试图声明它时,我有以下例外:

代码语言:javascript
复制
Method ClaimDevice threw an exception.  Attempt was made to perform an illegal 

or unsupported operation with the device, or an invalid parameter value was used.

即使在示例应用程序 (C:\Program \\SDK\Sample\Sample应用程序)文件夹(C:\Program\Microsoft\SDK\Samples)中提供的Microsoft 中,我也可以找到打印机,打开它,但是当我声明它时,我收到了以下错误消息:

代码语言:javascript
复制
POSControlException ErrorCode(Illegal) ExtendedErrorCode(10002) occurred:
Method ClaimDevice threw an exception.  Attempt was made to perform an illegal
 or unsupported operation with the device, or an invalid parameter value was 
used.

示例应用程序的打印屏幕:

EN

回答 1

Stack Overflow用户

发布于 2019-07-26 13:17:42

这个错误是因为您的端口配置不好。

在我的例子中,我使用了连接到硬件NPort 5110的FP-81 II模型,在那里我将端口配置为9100。

我希望能帮你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22430995

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档