Exemplo n.º 1
0
        protected override void DefWndProc(ref Message msg)
        {
            if (msg.Msg == USER + 123)//receive code info from the 532 dll
            {
                Dll_Camera.setQRable(false);
                Dll_Camera.setDMable(false);
                Dll_Camera.setBarcode(false);

                IntPtr wp    = new IntPtr((int)msg.WParam);
                byte[] wpbuf = new byte[((int)msg.LParam)];
                Marshal.Copy(wp, wpbuf, 0, ((int)msg.LParam));
                string strBC = System.Text.Encoding.GetEncoding("GB2312").GetString(wpbuf, 0, ((int)msg.LParam));
                this.codeInfo.AppendText(strBC.Trim());
                Thread.Sleep(2000);
                if (this.qrEnable == true)
                {
                    Dll_Camera.setQRable(true);
                }
                if (this.dmEnable == true)
                {
                    Dll_Camera.setDMable(true);
                }
                if (this.barEnable == true)
                {
                    Dll_Camera.setBarcode(true);
                }
            }
            else
            {
                base.DefWndProc(ref msg);
            }
        }
Exemplo n.º 2
0
        //定时器 定时查看设备连接状态
        private void timerCheck_Tick(object sender, EventArgs e)
        {
            if (!deviceState)
            {
                int flag = Dll_Camera.StartDevice();

                //Dll_Camera.StartDevice();启动设备
                //int result = Dll_Camera.GetDevice();

                if (flag == 1)
                //if(result == 1)
                {
                    //第三步:设置打开蜂鸣器,DLL默认不打开
                    Dll_Camera.SetBeep(true);
                    //设置一维
                    Dll_Camera.setBarcode(barEnable);
                    //设置qr
                    Dll_Camera.setQRable(qrEnable);
                    //设置dm
                    Dll_Camera.setDMable(dmEnable);
                    //设置扫码成功蜂鸣
                    Dll_Camera.SetBeepTime(100);
                    Dll_Camera.SetDecodeTime(200);

                    deviceState         = true;
                    this.labelText.Text = "解码信息:(设备已连接)";
                }
                else if (flag == -1)
                {
                    this.labelText.Text = "解码信息:(设备已启动)";
                }
                else if (flag == -2)
                {
                    this.labelText.Text = "解码信息:(设备已断开)";
                }
                else if (flag == -3)
                {
                    this.labelText.Text = "解码信息:(设备已初始化失败)";
                }
            }
            else
            {
                int result = Dll_Camera.GetDevice();
                // 定时获取设备信息
                if (result == 1)
                {
                    this.labelText.Text = "解码信息:(设备已连接)";
                }
                else
                {
                    deviceState = false;
                    Dll_Camera.ReleaseLostDevice();
                    this.labelText.Text = "解码信息:(设备已断开)";
                }
            }
        }
Exemplo n.º 3
0
 private void dmDecode_CheckedChanged(object sender, EventArgs e)
 {
     if (this.dmDecode.Checked == true)
     {
         this.dmEnable = true;
     }
     else
     {
         this.dmEnable = false;
     }
     Dll_Camera.setDMable(true);
 }