2

我正在尝试让我的摩托罗拉 MC3190 读取条形码。但不幸的是,按下硬件扫描按钮后没有任何反应。我将 EMDK 用于 .net 2.0 版。

这是我的代码:

private void Form1_Load(object sender, EventArgs e)
        {
            // Get the first scanning device (Its named SCN1 in my device) 
            myDevice = Symbol.Barcode.Device.AvailableDevices[0];
            myReader = new Reader(myDevice);

            // Make sure the Code-128 decoder is enabled!
            myReader.Decoders.CODE128.Enabled = true;

            // Create an instance of reader
            myReaderData = new Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text, Symbol.Barcode.ReaderDataLengths.MaximumLabel);

            // Set the event handler
            myReader.ReadNotify += new EventHandler(myReader_ReadNotify);

            // enable and get ready to read
            myReader.Actions.Enable();
            myReader.Actions.Read(myReaderData);
        }

在我的事件中,我只是想显示解码的文本:

void myReader_ReadNotify(object sender, EventArgs e)
        {
            Symbol.Barcode.ReaderData nextReaderData = myReader.GetNextReaderData();
            this.listBox1.Items.Add(nextReaderData.Text);            
            switch (nextReaderData.Result)
            {
                case Symbol.Results.SUCCESS:
                    this.listBox1.Items.Add(nextReaderData.Text);
                    myReader.Actions.Read(myReaderData);
                    break;

                case Symbol.Results.CANCELED:
                    this.listBox1.Items.Add("Canceled!!");
                    break;

                default:
                    string sMsg = "Read Failed\n"
                    + "Result = "
                    + ((int)nextReaderData.Result).ToString("X8");
                    MessageBox.Show(sMsg, "ReadNotify");
                    break;
            }


        }

没有收到任何错误消息。同时,如果我列出我可用的扫描设备,我可以看到我的设备(SCN1)。我需要做些什么来触发硬件密钥吗?

非常感谢解决此问题的任何帮助/想法。谢谢!

4

4 回答 4

2

Sometimes the motorola units come installed with the DataWedge application. It can claim access to the scanner and cause a number of issues when using the EMDK. Make sure it is disabled or uninstall it.

于 2012-02-28T16:01:01.627 回答
1

在您的设备设置中,条形码阅读器是否已打开?(只是得到了呐喊!首先排除干扰因素)

在我们的设备中,我们只是将条形码阅读器视为任何其他形式的文本输入。

我的表单上有一个TextBox控件,客户(我们的员工)选择它TextBox,将设备指向标签,然后扫描条形码。

我所做的就是阅读该TextBox1.Text领域。

于 2012-02-28T22:51:43.837 回答
0

在您的myReader_ReadNotify函数中,在第 4 行之后和第 5 行(开关)之前放置这一行:

myReader.Actions.Read(myReaderData);
于 2013-11-15T14:40:02.257 回答
0

我不太确定这个设备是否为不同的硬件使用相同的 COM 端口。如果选择 COM 端口使用条形码扫描仪,请检查设置。在具有大量硬件的设备中,COM 端口是共享的。

此外,如果您关闭应用程序并按下黄色按钮,条形码光束是否会显示?

设备是否支持您的条形码类型?

正如@jp2code 所说的基本功能,您可以使用 DataWedge 并将数据输入作为文本接收。

于 2012-02-28T23:07:09.807 回答