Reading eID card from VBA using Middleware ActiveX control
Sample code from godot.be
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command1.Click ' Written by Sylvain Kusters ' Free to use to everyone ' If you come with better solution (quicker) please let me also profit from your code. ' sk@startnet.be ' Visit also www.filmclub.info Dim lHandle As Integer 'BEID_ Kaart Info Dim strCardNumber As String Dim strBegValDag, strBegVal, strBegValMaand As Object Dim strBegValJaar As String Dim strEndValDag, strEndVal, strEndValMaand As Object Dim strEndValJaar As String Dim strIssuingMunicipality As String 'BEID Persoons Info Dim strName As String Dim strFirstName1 As String Dim strBirthPlace As String Dim strBirthDate As String Dim strGender As String Dim strNationality As String Dim strNationalNumber As String 'BEID Adres Info Dim strStreet As String Dim strZIPCode As String Dim strMunicipality As String 'BEID PICTURE Dim PictureFileName As String Dim FirstPath As String Dim EndPath As String Dim Path As String Dim RetStatus As EIDLIBCTRLLib.RetStatus Dim MapColPicture As New EIDLIBCTRLLib.MapCollection Dim MapColID As New EIDLIBCTRLLib.MapCollection Dim MapColAddress As New EIDLIBCTRLLib.MapCollection Dim CertifCheck As New EIDLIBCTRLLib.CertifCheck RetStatus = EIDlib1.Init("", 0, 0, lHandle) If (RetStatus.GetGeneral = 0) Then RetStatus = EIDlib1.GetID(MapColID, CertifCheck) strChipNumber = MapColID.GetValue("ChipNumber") strCardNumber = MapColID.GetValue("CardNumber") strBegVal = MapColID.GetValue("BeginValidityDate") strEndVal = MapColID.GetValue("EndValidityDate") strIssuingMunicipality = MapColID.GetValue("IssuingMunicipality") strName = MapColID.GetValue("Name") strFirstName1 = MapColID.GetValue("FirstName1") strBirthDate = MapColID.GetValue("BirthDate") strBirthPlace = MapColID.GetValue("BirthPlace") strGender = MapColID.GetValue("Gender") strNationality = MapColID.GetValue("Nationality") strNationalNumber = MapColID.GetValue("NationalNumber") 'Opsplitsen begindatum strBegValDag = VB.Right(strBegVal, 2) strBegValMaand = Mid(strBegVal, 5, 2) strBegValJaar = VB.Left(strBegVal, 4) 'Opsplitsen einddatum strEndValDag = VB.Right(strEndVal, 2) strEndValMaand = Mid(strEndVal, 5, 2) strEndValJaar = VB.Left(strEndVal, 4) txtbxCardNumber.Text = strCardNumber txtbxBeginValidityDate.Text = strBegValDag & "/" & strBegValMaand & "/" & strBegValJaar txtbxEndValidityDate.Text = strEndValDag & "/" & strEndValMaand & "/" & strEndValJaar txtbxIssuingMunicipality.Text = strIssuingMunicipality txtbxName.Text = strName txtbxFirstName1.Text = strFirstName1 txtbxBirthDate.Text = strBirthDate txtbxBirthPlace.Text = strBirthPlace txtbxGender.Text = strGender txtbxNationality.Text = strNationality txtbxNationalNumber.Text = strNationalNumber End If RetStatus = EIDlib1.GetAddress(MapColAddress, CertifCheck) strStreet = MapColAddress.GetValue("Street") strZIPCode = MapColAddress.GetValue("ZIPCode") strMunicipality = MapColAddress.GetValue("Municipality") txtbxStreet.Text = strStreet txtbxZIPCode.Text = strZIPCode txtbxMunicipality.Text = strMunicipality ' Picture inladen FirstPath = "(unknown)_BELPIC_" EndPath = "_4035" Path = "c:\Documents and settings\gebruiker\eid-cache" PictureFileName = FirstPath & strChipNumber & EndPath RetStatus = EIDlib1.GetPicture(MapColPicture, CertifCheck) Picture1.Image = System.Drawing.Image.FromFile(Path & "\" & PictureFileName) RetStatus = EIDlib1.Exit() End Sub
Serhiy,
ReplyDeleteBedankt, Maar kan je me ook helpen hoe ik de picture kan opslaan onder het juiste path ?
Groet,
Stijn