コード例 #1
0
 public static void SendKey(byte key)
 {
     const int KEYEVENTF_KEYUP = 0x02;
     const int KEYEVENTF_KEYDOWN = 0x00;
     //const int KEYEVENTF_SILENT = 0x04;
     HID.keybd_event(key, 0, KEYEVENTF_KEYDOWN, 0);
     HID.keybd_event(key, 0, KEYEVENTF_KEYUP, 0);
 }
コード例 #2
0
        private void timer_Req_Tick(object sender, EventArgs e)
        {
            // GetCount = MYcOUNT;
            try
            {
                timer_Req.Enabled = false;
                byte[] TypeCard = new byte[2];
                int    rr       = RFT230.MF_Request(0, 0, ref TypeCard[0]);
                if (rr == 0)
                {
                    byte[] tmpSnr = new byte[4];
                    if (RFT230.MF_Anticoll(0, ref tmpSnr[0]) == 0)
                    {
                        string SNR = ValidValue(tmpSnr[0].ToString("X"))
                                     + ValidValue(tmpSnr[1].ToString("X"))
                                     + ValidValue(tmpSnr[2].ToString("X"))
                                     + ValidValue(tmpSnr[3].ToString("X"));

                        //string SNR = tmpSnr[0].ToString("X") + tmpSnr[1].ToString("X") + tmpSnr[2].ToString("X") + tmpSnr[3].ToString("X");
                        SNR = Convert.ToString(Int64.Parse(SNR, System.Globalization.NumberStyles.HexNumber));
                        try
                        {
                            foreach (byte a in SNR + "\r")
                            {
                                HID.SendKey(a);
                            }
                        }
                        catch (Exception ee)
                        {
                            // EventLogHandler.CreateEventLog("frmCard, timer_Req_Tick(Catch1): " + ee.Message);
                        }
                    }

                    int[] Beep = { 10 };
                    RFT230.MF_ControlBuzzer(0, Beep[0]);
                    //    Counter++;
                }
                else if (rr == 33)
                {
                    DisConnect();
                    return;
                }
                timer_Req.Enabled = true;
            }

            catch (Exception ee)
            {
                // EventLogHandler.CreateEventLog("frmCard, timer_Req_Tick(Catch2): " + ee.Message);
                throw new Exception("خطا هنگام تلاش برای دریافت داده از کام   " + " .... " + ee.Message);
            }
        }