System.Runtime.InteropServices.COMException:'来自HRESULT的异常:0xFFFFFFF8'

时间:2019-02-23 02:29:56

标签: c# sdk fingerprint

我正在尝试验证存储在数据库中的指纹模板,但是我在项目中始终遇到此错误,我尝试在网上搜索解决方案,并将数据库中的数据类型转换为LONGBLOB,但仍然可以。工作。

扫描指纹样本后,弹出窗口,显示以下错误:

  

DPFP.Error.SDKException:事件处理程序已生成异常---> System.InvalidOperationException:在创建窗口句柄之前,无法在控件上调用Invoke或BeginInvoke。      在System.Windows.Forms.Control.MarshaledInvoke(控制调用方,委托方法,Object []参数,布尔同步)      在System.Windows.Forms.Control.Invoke(委托方法,Object []参数)      在System.Windows.Forms.Control.Invoke(Delegate方法)      在C:\ Users \ libun \ Desktop \ Thesis(GUI + Personal Info)\ Thesis中的Thesis_MainProgram.CaptureForm.MakeReport(字符串消息)处,取3 \ Thesis_MainProgram \ CaptureForm.cs:line 162      在C:\ Users \ libun \ Desktop \ Thesis(GUI + Personal Info)\ Thesis中的Thesis_MainProgram.CaptureForm.OnFingerGone(对象捕获,字符串ReaderSerialNumber)下,取3 \ Thesis_MainProgram \ CaptureForm.cs:line 100      在DPFP.Capture.Capture.MessageReceived(Message&m)      ---内部异常堆栈跟踪的结尾---      在DPFP.Capture.Capture.MessageReceived(Message&m)      在DPFP.Capture.Capture.MessageEvents.MessageWindow.WndProc(Message&m)

这是我的代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ClassLibrary1;
using System.IO;
using MySql.Data.MySqlClient;

namespace Thesis_MainProgram
{
    public partial class Verification : CaptureForm
    {
        Connection connect = new Connection();
        byte[] im;
        MySqlConnection conn = new MySqlConnection("datasource=localhost;port=3306;username=root;password=201531748");

        public void Verify(DPFP.Template template)
        {
            Template = template;
            ShowDialog();
        }

        protected override void Init()
        {
            base.Init();
            base.Text = "Fingerprint Verification";
            Verificator = new DPFP.Verification.Verification();     // Create a fingerprint template verificator
            UpdateStatus(0);
        }

        protected override void Process(DPFP.Sample Sample)
        {
            base.Process(Sample);

            // Process the sample and create a feature set for the enrollment purpose.

            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            // Check quality of the sample and start verification if it's good
            // TODO: move to a separate task
            if (features != null)
            {
                conn.Open();
                MySqlCommand cmd = new MySqlCommand("SELECT Fingerprint FROM payroll_db.employee WHERE ID = 201531777", conn);
                MySqlDataReader dr = cmd.ExecuteReader();

                while ((dr.Read()))
                {
                    im = (byte[])(dr["Fingerprint"]);
                    Stream stream = new MemoryStream(im);
                    DPFP.Template Fingerprint = new DPFP.Template(stream);

                    // Compare the feature set with our template
                    DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result();
                    Verificator.Verify(features, Fingerprint, ref result);
                    UpdateStatus(result.FARAchieved);
                    if (result.Verified)
                        MakeReport("The fingerprint was VERIFIED.");
                    else
                        MakeReport("The fingerprint was NOT VERIFIED.");

                    conn.Close();
                }
            }
        }

        private void UpdateStatus(int FAR)
        {
            // Show "False accept rate" value
            SetStatus(String.Format("False Accept Rate (FAR) = {0}", FAR));
        }

        private DPFP.Template Template;
        private DPFP.Verification.Verification Verificator;

    }
}

0 个答案:

没有答案