Click here to Skip to main content
15,914,419 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: passing values from a form to a dialog form Pin
macupryk9-Sep-05 23:38
macupryk9-Sep-05 23:38 
AnswerRe: passing values from a form to a dialog form Pin
Rizwan Bashir9-Sep-05 23:26
Rizwan Bashir9-Sep-05 23:26 
GeneralRe: passing values from a form to a dialog form Pin
macupryk9-Sep-05 23:40
macupryk9-Sep-05 23:40 
GeneralRe: passing values from a form to a dialog form Pin
Rizwan Bashir10-Sep-05 9:08
Rizwan Bashir10-Sep-05 9:08 
QuestionHow I can give XP control looks in VB.net controls Pin
deepak_rai9-Sep-05 4:32
deepak_rai9-Sep-05 4:32 
AnswerRe: How I can give XP control looks in VB.net controls Pin
rudy.net11-Sep-05 17:20
rudy.net11-Sep-05 17:20 
QuestionXP control look in VB.net controls Pin
deepak_rai9-Sep-05 4:28
deepak_rai9-Sep-05 4:28 
QuestionImage conversion help, pixel byte array to image Pin
Anonymous9-Sep-05 2:47
Anonymous9-Sep-05 2:47 
Hello,

I'm tying to work with a dll written in C that control's my fingerprint reader, the problem is i can't convert image data to a valid image in vb
dot net. The function EndAcquireImage fills a byte array with image information, the function ATCopyImagePixels extracts the pixels from the EndAcquireImage image data. With the ATGetImageXYSizes you can get width/height.

I tried several ways no luck at all, can someone help me?

Greetz
Dave

Imports System.Reflection
Imports System.Runtime.InteropServices
Imports Microsoft.VisualBasic.ControlChars
Imports System.IO

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Structure _tsAT_API_MSG
Dim uiMessageType As UInt16
Dim pMessageData As IntPtr
End Structure

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATInit", SetLastError:=True)> _
Public Shared Function ATInit() As Int16
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATOpenSensorA", SetLastError:=True)> _
Public Shared Function ATOpenSensor(ByVal pszStrSensorName As SByte, ByVal iOpenMode As Int16) As Int16
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATBeginAcquireImage", SetLastError:=True)> _
Public Shared Function ATBeginAcquireImage(ByVal RetProc As CallbackHandler, ByRef uiCallerDWord As IntPtr, ByVal uiOperationType As UInt16, ByRef pVerifyTemplate As IntPtr) As Int16
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATEndAcquireImage", SetLastError:=True)> _
Public Shared Function ATEndAcquireImage(ByVal pImageItem() As System.Byte) As Int16
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATReleaseMessage", SetLastError:=True)> _
Public Shared Sub ATReleaseMessage(ByRef APIMsgToRelease As _tsAT_API_MSG)
End Sub

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATGetImageBufferSize", SetLastError:=True)> _
Public Shared Function ATGetImageBufferSize() As Int32
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATGetImagePixelBufferSize", SetLastError:=True)> _
Public Shared Function ATGetImagePixelBufferSize(ByVal pImageItem() As System.Byte) As Int32
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATCopyImagePixels", SetLastError:=True)> _
Public Shared Function ATCopyImagePixels(ByVal pPixelBuffer() As System.Byte, ByVal pImageItem() As System.Byte) As Int16
End Function

<DllImport("ATSC63.dll", CallingConvention:=CallingConvention.Cdecl, _
CharSet:=CharSet.Auto, EntryPoint:="ATGetImageXYSizes", SetLastError:=True)> _
Public Shared Function ATGetImageXYSizes(ByVal pImageItem() As System.Byte, ByRef piImageHeight As Int32, ByRef piImageWidth As Int32) As Int16
End Function

Delegate Sub CallbackHandler(ByRef uiCallerDWord As IntPtr, ByRef tsAT_API_MSG As _tsAT_API_MSG)

Public ImageItem() As System.Byte
Public ImageBufferSize As Int32
Public PixelBuffer() As System.Byte
Public PixelBufferSize As Int32
Public PixelHeight As Int32
Public PixelWidth As Int32

Public Sub translateInfo(ByRef tsAT_API_MSG As _tsAT_API_MSG)

Dim msgnumber As Int16 = Int16.Parse(tsAT_API_MSG.uiMessageType.ToString)

Select Case msgnumber
Case 0 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_NEW_DISPLAY_IMAGE"
Case 1 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_FINGER_DETECTED"
Case 2 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_FINGER_REMOVED"
Case 3 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_DATABASE_CHANGE"
Case 4 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_PLACE_FINGER"
Case 5
txtInfo.Text = txtInfo.Text & CrLf & "AT_API_ACQUIRE_DATA_RDY"
process_AT_API_ACQUIRE_DATA_RDY()
Case 6 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_ENROLL_DATA_RDY"
Case 7 : txtInfo.Text = txtInfo.Text & CrLf & "API_VALIDATE_DATA_RDY"
Case 8 : txtInfo.Text = txtInfo.Text & CrLf & "API_VERIFY_DATA_RDY"
Case 9 : txtInfo.Text = txtInfo.Text & CrLf & "API_IDENTIFY_DATA_RDY"
Case 10 : txtInfo.Text = txtInfo.Text & CrLf & "API_VERIFY_DATA_RDY"
Case 11 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_NO_CORE"
Case 12 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_LIFT_AND_REPLACE"
Case 13 : txtInfo.Text = txtInfo.Text & CrLf & "T_API_TIMEOUT"
Case 14 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_LOST_SENSOR_FOCUS"
Case 15 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_FAKE_FINGER_DETECTED"
Case 16 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_RESERVED_1"
Case 17 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_FAST"
Case 18 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_SLOW"
Case 19 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SENSOR_SURFACE_DIRTY"
Case 20 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SLIDE_FINGER"
Case 21 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_RESLIDE_FINGER"
Case 22 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_NAV_DATA_RDY"
Case 23 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_SHORT"
Case 24 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_SKEWED"
Case 25 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_FAR_LEFT"
Case 26 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_FAR_RIGHT"
Case 27 : txtInfo.Text = txtInfo.Text & CrLf & "AT_API_SWIPE_TOO_LITTLE_PRESSURE"
Case Else : MessageBox.Show(msgnumber.ToString)
End Select

ATReleaseMessage(tsAT_API_MSG)

End Sub

Private Sub parseGinfo(ByVal strInfo As String, ByVal result As Int16)
txtGinfo.Text = txtGinfo.Text & CrLf & strInfo & result.ToString
End Sub

Private Sub Messagehandler(ByRef uiCallerDWord As IntPtr, ByRef tsAT_API_MSG As _tsAT_API_MSG)
translateInfo(tsAT_API_MSG)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As Int16

result = ATInit()
parseGinfo("init: ", result)

result = ATOpenSensor(SByte.Parse("0"), Int16.Parse("2"))
parseGinfo("opensensor: ", result)

result = ATBeginAcquireImage(AddressOf Messagehandler, IntPtr.Zero, UInt16.Parse("0"), IntPtr.Zero)
parseGinfo("BeginAcquireImage: ", result)
End Sub

Private Sub process_AT_API_ACQUIRE_DATA_RDY()
Dim result As Int16

ImageBufferSize = ATGetImageBufferSize()
ReDim ImageItem(ImageBufferSize)



result = ATEndAcquireImage(ImageItem)
parseGinfo("EndAcquireImage: ", result)

PixelBufferSize = ATGetImagePixelBufferSize(ImageItem)
ReDim PixelBuffer(PixelBufferSize)


result = ATCopyImagePixels(PixelBuffer, ImageItem)
parseGinfo("CopyImagePixels: ", result)

result = ATGetImageXYSizes(PixelBuffer, PixelHeight, PixelWidth)
parseGinfo("GetImageXYSizes: ", result)
MessageBox.Show(PixelHeight & " " & PixelWidth)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim ms As New MemoryStream(PixelBuffer)

pbPrint.Image = Image.FromStream(ms)
pbPrint.SizeMode = PictureBoxSizeMode.CenterImage

End Sub
End Class
AnswerRe: Image conversion help, pixel byte array to image Pin
Dave Kreskowiak9-Sep-05 4:16
mveDave Kreskowiak9-Sep-05 4:16 
GeneralRe: Image conversion help, pixel byte array to image Pin
Anonymous12-Sep-05 10:30
Anonymous12-Sep-05 10:30 
GeneralRe: Image conversion help, pixel byte array to image Pin
charles09298827-Sep-10 20:35
charles09298827-Sep-10 20:35 
QuestionNOT VB .... VBA Pin
OMalleyW9-Sep-05 2:07
OMalleyW9-Sep-05 2:07 
AnswerRe: NOT VB .... VBA Pin
Dave Kreskowiak9-Sep-05 2:23
mveDave Kreskowiak9-Sep-05 2:23 
GeneralRe: NOT VB .... VBA Pin
OMalleyW9-Sep-05 2:59
OMalleyW9-Sep-05 2:59 
GeneralRe: NOT VB .... VBA Pin
Dave Kreskowiak9-Sep-05 4:10
mveDave Kreskowiak9-Sep-05 4:10 
GeneralRe: NOT VB .... VBA Pin
OMalleyW9-Sep-05 4:34
OMalleyW9-Sep-05 4:34 
QuestionHow to cumulate input values Pin
directred9-Sep-05 1:01
directred9-Sep-05 1:01 
AnswerRe: How to cumulate input values Pin
Dave Kreskowiak9-Sep-05 2:15
mveDave Kreskowiak9-Sep-05 2:15 
GeneralRe: How to cumulate input values Pin
directred9-Sep-05 3:09
directred9-Sep-05 3:09 
QuestionWindows Form Inheritance Issue Pin
Jason Stamp9-Sep-05 0:33
Jason Stamp9-Sep-05 0:33 
Questiongetting homepath for currently logged in user Pin
Shivani Arora8-Sep-05 23:59
Shivani Arora8-Sep-05 23:59 
AnswerRe: getting homepath for currently logged in user Pin
Dave Kreskowiak9-Sep-05 2:10
mveDave Kreskowiak9-Sep-05 2:10 
GeneralRe: getting homepath for currently logged in user Pin
jcrussell11-Sep-05 15:49
jcrussell11-Sep-05 15:49 
Questionsetting the image of crystal report object during the runtime Pin
Hemesh8-Sep-05 20:30
Hemesh8-Sep-05 20:30 
QuestionMovable Toolbar Pin
kenexcelon8-Sep-05 20:25
kenexcelon8-Sep-05 20:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.