unsafe void fuzzingThread(object objParm)
        {
            FUZZINGPARM      parm = (FUZZINGPARM)objParm;
            Form_ProgressBar form = parm.form;
            CAN_OBJ          obj  = parm.obj;
            int  delay            = parm.delay;
            byte index            = parm.index;
            byte min = parm.min;
            byte max = parm.max;
            int  rep = parm.rep;

            parm.mrEvent.WaitOne();

            usbCAN.arrSendBuf[0].ID         = obj.ID;
            usbCAN.arrSendBuf[0].DataLen    = obj.DataLen;
            usbCAN.arrSendBuf[0].ExternFlag = obj.ExternFlag;
            usbCAN.arrSendBuf[0].RemoteFlag = obj.RemoteFlag;
            for (int d = 0; d < 8; d++)
            {
                usbCAN.arrSendBuf[0].Data[d] = obj.Data[d];
            }

            for (int i = min; i <= max; i++)
            {
                for (int t = 0; t < rep; t++)
                {
                    usbCAN.arrSendBuf[0].Data[index] = (byte)i;
                    usbCAN.sendFame(1);
                    Thread.Sleep(delay);
                }

                form.addValue();
            }

            form.returnResult = DialogResult.OK;
            form.Invoke(new Action(() => { form.Close(); }));
        }
        private void buttonFuzzy_Click(object sender, EventArgs e)
        {
            FUZZINGPARM parm = new FUZZINGPARM();

            try { parm.obj.ID = Convert.ToUInt32(dataGridViewfuzzy.Rows[0].Cells[0].Value.ToString(), 16); }
            catch (Exception) { MessageBox.Show("请填写正确的16进制ID"); return; }

            try { parm.obj.DataLen = Convert.ToByte(dataGridViewfuzzy.Rows[0].Cells[1].Value); }
            catch (Exception) { MessageBox.Show("请填写正确长度"); return; }

            for (int d = 0; d < 8; d++)
            {
                try { parm.obj.Data[d] = Convert.ToByte(dataGridViewfuzzy.Rows[0].Cells[2 + d].Value.ToString(), 16); }
                catch (Exception) { MessageBox.Show("请填写正确的16进制DATA" + d.ToString()); return; }
            }

            if (dataGridViewfuzzy.Rows[0].Cells[10].Value.ToString().Equals("标准帧"))
            {
                parm.obj.ExternFlag = 0;
            }
            else if (dataGridViewfuzzy.Rows[0].Cells[10].Value.ToString().Equals("扩展帧"))
            {
                parm.obj.ExternFlag = 1;
            }
            else
            {
                MessageBox.Show("请选择格式");
                return;
            }

            if (dataGridViewfuzzy.Rows[0].Cells[11].Value.ToString().Equals("数据帧"))
            {
                parm.obj.RemoteFlag = 0;
            }
            else if (dataGridViewfuzzy.Rows[0].Cells[11].Value.ToString().Equals("远程帧"))
            {
                parm.obj.RemoteFlag = 1;
            }
            else
            {
                MessageBox.Show("请选择类型");
                return;
            }

            try { parm.delay = Convert.ToInt32(dataGridViewfuzzy.Rows[0].Cells[12].Value); }
            catch (Exception) { MessageBox.Show("请输入正确的延时"); return; }

            if (comboBoxDataIndex.SelectedIndex == -1)
            {
                MessageBox.Show("请选择数据索引");
                return;
            }

            parm.index = (byte)comboBoxDataIndex.SelectedIndex;

            try { parm.min = Convert.ToByte(textBoxFuzzyMin.Text, 16); }
            catch (Exception) { MessageBox.Show("请输入正确的16进制下界范围"); return; }

            try { parm.max = Convert.ToByte(textBoxFuzzyMax.Text, 16); }
            catch (Exception) { MessageBox.Show("请输入正确的16进制上界范围"); return; }

            if (parm.min > parm.max)
            {
                byte tmp = parm.min;
                parm.min = parm.max;
                parm.max = tmp;
            }

            try { parm.rep = Convert.ToInt32(textBoxRepeat.Text); }
            catch (Exception) { MessageBox.Show("请输入正确的循环次数"); return; }

            if (usbCAN.shutDevice() == false)
            {
                return;
            }

            usbCAN.ProcessingFrame = NullProc;

            if (usbCAN.startDevice() == false)
            {
                return;
            }

            threadFuzzy  = new Thread(new ParameterizedThreadStart(fuzzingThread));
            parm.mrEvent = new ManualResetEvent(false);
            parm.form    = new Form_ProgressBar(parm.max - parm.min + 1, parm.mrEvent, threadFuzzy);

            threadFuzzy.Start(parm);

            parm.form.ShowDialog();

            if (parm.form.returnResult == DialogResult.Abort)
            {
                MessageBox.Show("你终止了操作");
            }

            threadFuzzy.Abort();
            threadFuzzy = null;
        }