This might be a super basic issue, but I am a super basic programmer, so here I go.
I am creating a byte array with image information extacted from a database field (with a routine RhinoBull posted here some time ago)
These are the steps:
1. Create Recordset with all records in table which contain an image in the IMAGE field
2. Loop through the Recordset, and extract data in the IMAGE field to a byte() variable
3. With that info (per record) call a procedure that will use that byte() variable
When I call cmdEnrollFinger2 (bytes()) from the first procedure I get an error (in spanish) that says something like "Compile error: Type mismatch error: an array or a user defined type was expected"Code:Public Sub ExtractImage() Dim bytes() As Byte Dim file_length As Long Dim num_blocks As Long Dim left_over As Long Dim block_num As Long Dim hgt As Single Dim Opr As New TablasManager Dim Str_SQl As String Dim Str_Cn_Prod As String Str_Cn_Prod = "driver={SQL Server};server=200.9.220.58;database=SIG;uid=sa;pwd=" Str_SQl = "EXEC SIG.dbo.BT_L_Choferes" On Error GoTo ErrHandler Screen.MousePointer = vbHourglass Set rs = Opr.EjecutarSPconRS(Str_SQl, adOpenForwardOnly, adLockReadOnly) If rs.EOF Then Screen.MousePointer = vbDefault Exit Sub End If If IsNull(rs.Fields("BioID")) Then Screen.MousePointer = vbDefault Exit Sub End If rs.MoveFirst Do While Not rs.EOF file_length = rs.Fields("Filesize") num_blocks = file_length / BLOCK_SIZE left_over = file_length Mod BLOCK_SIZE 'get all chunks and write then to a temp file For block_num = 1 To num_blocks bytes() = rs.Fields("BioID").GetChunk(BLOCK_SIZE) 'Put #file_num, , bytes() Next block_num If left_over > 0 Then bytes() = rs.Fields("BioID").GetChunk(left_over) 'Put #file_num, , bytes() End If cmdEnrollFinger2 (bytes()) Loop Screen.MousePointer = vbDefault Exit Sub ErrHandler: Debug.Print Err.Description Err.Clear Screen.MousePointer = vbDefault 'Resume Next Exit Sub End Sub Private Sub cmdEnrollFinger2(ByRef huella() As Byte) Dim iStatus As Long Dim iEnSize As Long Dim r_value, r_value2 As Boolean r_value2 = bAPI4_HMFVEnroll(SENSOR_RESOLUTION, SENSOR_WIDTH, SENSOR_HEIGHT, huella(0), pEnrolledFeatures(0), iEnSize, iStatus) End Sub
I kind of remember that passing byte arrays as parameters was a bit tricky, but I can't find any specific information on the web
Anyone can help??
Thanks




Reply With Quote
