예제 #1
0
        private void BaseFormScan_Load(object sender, EventArgs e)
        {
            /*
             * tips:
             * 1、在程序启动的时候开启扫描头;
             * 2、在程序退出的时候关闭扫描头;
             */
            this.KeyPreview = true;

            scanStartEvent = Win32.CreateEvent(IntPtr.Zero, true, false, null);
            scanStopEvent  = Win32.CreateEvent(IntPtr.Zero, true, false, null);
            stopEvent      = Win32.CreateEvent(IntPtr.Zero, false, false, null);

            msgWindow = new MsgWindow(this);
            // Scanner.RegisterScannerMessage(msgWindow.Hwnd, BaseFormScan.WM_SCANMSG);

            // 启动扫描线程
            Thread tScan = new Thread(new ThreadStart(this.scanThreadProc));

            tScan.Start();
        }
예제 #2
0
        private void BaseFormScan_Load(object sender, EventArgs e)
        {
            /*
            * tips:
            * 1、在程序启动的时候开启扫描头;
            * 2、在程序退出的时候关闭扫描头;
            */
            this.KeyPreview = true;

            scanStartEvent = Win32.CreateEvent(IntPtr.Zero, true, false, null);
            scanStopEvent = Win32.CreateEvent(IntPtr.Zero, true, false, null);
            stopEvent = Win32.CreateEvent(IntPtr.Zero, false, false, null);

            msgWindow = new MsgWindow(this);
            Scanner.RegisterScannerMessage(msgWindow.Hwnd, BaseFormScan.WM_SCANMSG);

            // 启动扫描线程
            Thread tScan = new Thread(new ThreadStart(this.scanThreadProc));
            tScan.Start();
        }