0

C# コンパクト フレームワーク 2.0 (windows mobile 6.1) の 2D リーダーを備えた Intermec ハンドヘルド デバイス CK30 用に開発しています。

バーコードを使用するたびに、キーボードが機能しなくなります。理由はありますか?

コードはこちら。最初のセクションは、バーコード リーダーを構成するクラスです。2 番目のセクションは、バーコード リーダーを使用してテキスト ボックスに入力するフォームです。

バーコードリーダーで何かを読み取った後、キーボードが機能しなくなります...

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using Intermec.DataCollection;

namespace BarCodeReaderTest
{
    class LeitorCodigoDeBarras
    {
        public BarcodeReader LerCodigoDeBarras()
        {
            try
            {
                BarcodeReader meuLeitor = new BarcodeReader("default", 4096);
                meuLeitor.ScannerEnable = true;
                meuLeitor.ThreadedRead(true);

                return meuLeitor;
            }
            catch (BarcodeReaderException bx)
            {
                MessageBox.Show("Não foi possível inicializar o leitor de código de     barras. Contate seu supervisor. \n" + bx.Message);

                return null;
            }
        }
    }
}


using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using Intermec.DataCollection;

namespace BarCodeReaderTest
{
    public partial class Form1 : Form
    {



        public BarcodeReader leitor;

        public Form1()
        {

            InitializeComponent();

            LeitorCodigoDeBarras classeLeitor = new LeitorCodigoDeBarras();

            leitor = classeLeitor.LerCodigoDeBarras();
            leitor.BarcodeRead += new     BarcodeReadEventHandler(this.eventoLeitorCodigoDeBarras);

        }


        void eventoLeitorCodigoDeBarras(object sender, BarcodeReadEventArgs e)
        {
            tbCodLido.Text = e.strDataBuffer;
        }
    }        
}
4

1 に答える 1

1

OK、別のクラス内で BarcodeReader を使用していることを確認しました。

次の標準的な例を試してください (フォーム内の 1 つのリストボックスと 1 つのボタン):

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Intermec.DataCollection;
namespace BarcodeReader
{
    public partial class Form1 : Form
    {
        private Intermec.DataCollection.BarcodeReader bcr;
        public Form1()
        {
            InitializeComponent();
            bcr = new Intermec.DataCollection.BarcodeReader();
            bcr.BarcodeRead += new BarcodeReadEventHandler(bcr_BarcodeRead);
            bcr.ThreadedRead(true);
        }
        void bcr_BarcodeRead(object sender, BarcodeReadEventArgs bre)
        {
            this.listBox1.Items.Add(bre.strDataBuffer);
        }
    }
    private void btnExit_Click(object sender, EventArgs e)
    {
        if (bcr !=null)
        {
            bcr.Dispose();
        }
        Application.Exit();
    }
}

それが機能する場合 (Intermec Datacollection リソース キットに付属の例も参照)、構築したものが機能しない理由を調べることができます。最新の DataCollection Resource Kit がインストールされていることを前提としています。

于 2013-03-22T16:21:26.530 に答える