protected override void DefWndProc(ref Message m) { switch (m.Msg) { case MESSAGE_CAPTURED_OK: { MemoryStream ms = new MemoryStream(); BitmapFormat.GetBitmap(FPBuffer, fpInstance.imageWidth, fpInstance.imageHeight, ref ms); Bitmap bmp = new Bitmap(ms); this.picFPImg.Image = bmp; if (IsRegister) { int ret = zkfp.ZKFP_ERR_OK; int fid = 0, score = 0; ret = fpInstance.Identify(CapTmp, ref fid, ref score); if (zkfp.ZKFP_ERR_OK == ret) { textRes.Text = "This finger was already register by " + fid + "!"; return; } if (RegisterCount > 0 && fpInstance.Match(CapTmp, RegTmps[RegisterCount - 1]) <= 0) { textRes.Text = "Please press the same finger 3 times for the enrollment"; return; } Array.Copy(CapTmp, RegTmps[RegisterCount], cbCapTmp); RegisterCount++; if (RegisterCount >= REGISTER_FINGER_COUNT) { RegisterCount = 0; if (zkfp.ZKFP_ERR_OK == (ret = fpInstance.GenerateRegTemplate(RegTmps[0], RegTmps[1], RegTmps[2], RegTmp, ref cbRegTmp)) && zkfp.ZKFP_ERR_OK == (ret = fpInstance.AddRegTemplate(iFid, RegTmp))) { iFid++; textRes.Text = "enroll succ"; } else { textRes.Text = "enroll fail, error code=" + ret; } IsRegister = false; return; } else { textRes.Text = "You need to press the " + (REGISTER_FINGER_COUNT - RegisterCount) + " times fingerprint"; } } else { if (cbRegTmp <= 0) { textRes.Text = "Please register your finger first!"; return; } if (bIdentify) { int ret = zkfp.ZKFP_ERR_OK; int fid = 0, score = 0; ret = fpInstance.Identify(CapTmp, ref fid, ref score); if (zkfp.ZKFP_ERR_OK == ret) { textRes.Text = "Identify succ, fid= " + fid + ",score=" + score + "!"; return; } else { textRes.Text = "Identify fail, ret= " + ret; return; } } else { int ret = fpInstance.Match(CapTmp, RegTmp); if (0 < ret) { textRes.Text = "Match finger succ, score=" + ret + "!"; return; } else { textRes.Text = "Match finger fail, ret= " + ret; return; } } } } break; default: base.DefWndProc(ref m); break; } }