JohanPrinsloo
Member
Hi all. This is the first time Im working with the fingerprint scanner myself. I believe it kinda works the same as all the others, it reads your fingerprint into a byte array, then I need to convert it to a system image to put it into a picturebox, or save it on a harddrive as a jpg.
Im getting the error "Parameter is not valid." When I am trying to convert to image. Obviously Im doing something wrong, and Im not quite sure what. Can someone please help me in the right direction?
Im getting the error "Parameter is not valid." When I am trying to convert to image. Obviously Im doing something wrong, and Im not quite sure what. Can someone please help me in the right direction?
Code:
Public Declare Function AET60_Capture Lib "AET60.dll" (ByRef Template As Byte, ByRef TemplateLength As Integer, ByVal TimeOut As Integer) As Integer
Public iRetcode As Integer
Private Sub sbCaptureFingerprint()
Try
Dim iProcTimeOut As Integer
Dim iFpTemplateLength As Integer
Dim tmpTemplate(0 To 767) As Byte
iProcTimeOut = 60000
iFpTemplateLength = 768
Dim imgByte(0 To 767) As Byte
iRetcode = AET60_Capture(imgByte(0), iFpTemplateLength, iProcTimeOut)
PictureBox1.Image = fConvertTo(imgByte)
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Critical, "Saving Image")
End Try
End Sub
Public Overloads Function fConvertTo(ByVal ImageArray As Byte()) As System.Drawing.Image
Dim objMS As New System.IO.MemoryStream
objMS.Write(ImageArray, 0, ImageArray.Length)
Try
and this is where I get the error
fConvertTo = System.Drawing.Image.FromStream(objMS)
Catch ae As System.ArgumentException
fConvertTo = Nothing
End Try
End Function
Last edited by a moderator: