Recently do a fingerprint capture and comparison of the function, because the company's entire project is the Web type, so the Fingerprint collection module to be nested in the Web page, that only with ActiveX, the following are some of the operation and effect, make a note!
Create a new user control and write the CS code as follows:
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Drawing;usingSystem.Data;usingSystem.Text;usingSystem.Runtime.InteropServices;usingSystem.Windows.Forms;usingSystem.IO;usingSystem.Reflection;namespacefingertool{[Guid ("5136cba1-59b0-4a96-b2dc-64062a81f377")] Public Partial classfingertooluc:usercontrol,iobjectsafety { PublicFingertooluc () {InitializeComponent (); } frmmain FM=NULL; Public voidShowsettingform () {if(FM = =NULL) {FM=Newfrmmain (); } FM. ShowDialog (); } #regionInvoking the JS interface[ComImport, Guid ("00000118-0000-0000-c000-000000000046"), InterfaceType (Cominterfacetype.interfaceisiunknown)] Public InterfaceIOleClientSite {voidSaveobject (); voidGetMoniker (UINTDwassign,UINTDwwhichmoniker,ObjectPPMK); voidGetContainer ( outIOleContainer Ppcontainer); voidShowobject (); voidOnshowwindow (BOOLfshow); voidrequestnewobjectlayout (); } [ComImport, Guid ("0000011b-0000-0000-c000-000000000046"), InterfaceTypeAttribute (Cominterfacetype.interfaceisiunknown)] Public InterfaceIOleContainer {voidEnumObjects ([In, MarshalAs (UNMANAGEDTYPE.U4)]intGrfflags, [out, MarshalAs (UnmanagedType.LPArray)]Object[] ppenum); voidParseDisplayName ([In, MarshalAs (Unmanagedtype.interface)]ObjectPBC, [In, MarshalAs (UNMANAGEDTYPE.BSTR)]stringpszDisplayName, [out, MarshalAs (UnmanagedType.LPArray)]int[] Pcheaten, [out, MarshalAs (UnmanagedType.LPArray)]Object[] ppmkout); voidLockcontainer ([In, MarshalAs (UNMANAGEDTYPE.I4)]intFLock); } #endregion #regionIE Secure InterfacePrivate Const string_iid_idispatch ="{00020400-0000-0000-c000-000000000046}"; Private Const string_iid_idispatchex ="{A6EF9860-C720-11D0-9337-00A0C90DCAA9}"; Private Const string_iid_ipersiststorage ="{0000010a-0000-0000-c000-000000000046}"; Private Const string_iid_ipersiststream ="{00000109-0000-0000-c000-000000000046}"; Private Const string_iid_ipersistpropertybag ="{37d84f60-42cb-11ce-8135-00aa004bb851}"; Private Const intInterfacesafe_for_untrusted_caller =0x00000001; Private Const intInterfacesafe_for_untrusted_data =0x00000002; Private Const intS_OK =0; Private Const intE_fail =unchecked((int)0x80004005); Private Const intE_nointerface =unchecked((int)0x80004002); Private BOOL_fsafeforscripting =true; Private BOOL_fsafeforinitializing =true; Public intGetInterfaceSafetyOptions (refGuid riid,ref intPdwsupportedoptions,ref intpdwenabledoptions) { intRSLT =E_fail; stringstrGUID = riid. ToString ("B"); Pdwsupportedoptions= Interfacesafe_for_untrusted_caller |Interfacesafe_for_untrusted_data; Switch(strguid) { Case_iid_idispatch: Case_iid_idispatchex:rslt=S_OK; Pdwenabledoptions=0; if(_fsafeforscripting = =true) Pdwenabledoptions=Interfacesafe_for_untrusted_caller; Break; Case_iid_ipersiststorage: Case_iid_ipersiststream: Case_iid_ipersistpropertybag:rslt=S_OK; Pdwenabledoptions=0; if(_fsafeforinitializing = =true) Pdwenabledoptions=Interfacesafe_for_untrusted_data; Break; default: Rslt=E_nointerface; Break; } returnRslt; }
Fingerprint acquisition Key code:
Private voidAxzkfpengx1_onimagereceived (Objectsender, Axzkfpengxcontrol.izkfpengxevents_onimagereceivedevent e) { if(!e.aimagevalid)return; if(axzkfpengx1.isdisposed)return; Try { if(pictureBox1.Image! =NULL) {pictureBox1.Image.Dispose ();//releasing a file resourcepictureBox1.Image =NULL;//Clear Picture } if(!System.IO.Directory.Exists (Mvpath)) {System.IO.Directory.CreateDirectory (Mvpath); } stringFilePath = Mvpath +"\\"+ Guid.NewGuid (). ToString () +". bmp"; Axzkfpengx1.savebitmap (FilePath);//Save new filepictureBox1.Image = System.Drawing.Bitmap.FromFile (FilePath);//Show PicturesPicturebox1.refresh (); if( This. TxtValue.Text.Trim ()! ="") {setmsg ("","Control"); } } Catch(Exception ex) {MessageBox.Show (ex). Message); } } Private voidAxzkfpengx1_onfeatureinfo (Objectsender, Axzkfpengxcontrol.izkfpengxevents_onfeatureinfoevent e) { stringStemp =""; if(axzkfpengx1.isregister) {stemp="Registration Status: Also need to press:"+ (Axzkfpengx1.enrollindex-1). ToString () +"Secondary fingerprint"; } stemp= Stemp +"Fingerprint quality"; if(E.aquality! =0) { if(E.aquality = =1) {stemp= Stemp +"not enough feature points"; } Else{stemp= Stemp +"No fingerprint signatures can be taken for other reasons"; } } Else{stemp= Stemp +"qualified"; } This. Lblmessage.text =stemp; }
The Fingerprint verification section, the last saved fingerprint is the converted BASE64 string
stringValue_old="";//already registered fingerprints.stringValue_curr="";//the current fingerprint BOOLIsOK =false; BOOLBregchange =false; if(Axzkfpengx1.verfingerfromstr (refValue_old, Value_curr,false,refBregchange)) {IsOK=true; } if(Axzkfpengx1.verfingerfromstr (refValue_old2, Value_curr,false,refBregchange)) {IsOK=true; } if(IsOK) {MessageBox.Show ("OK"); } Else{MessageBox.Show ("NG"); }
Set COM properties for a project
Register this plugin on the page
The number of fingerprint acquisition can be customized, the default is to collect three times after the save, the device is a central control of the collector.
C # Developing ActiveX controls and fingerprint capture