Thursday 15 August 2013

Can't read native C++ BYTE * in VB.NET -


I'm trying to read passport information in a reader (Marjed) which uses CE 6 net. Seller API C + +

  is went to type // [C +] Taipingfes Int (* CRXCALLBACK) (byte * Perekbf, Anditalen Int); Ent Fare Pascal Exports CRX Open (CRX Klackack LPDTAQ); The   

This is my VB.NET implementation

  '[VB.NET] Public Class CRX public representative function CRXCALLBACK (ByVal pRecvBuff System.IntPtr, ByVal Form NDataLen as integer) integer & lt; DllImport ("Mrz.dll", entrypoint: = "CRX_Open", SetLastError: = true) & gt; _ Public Shared Function CRX_Open (ByVal lpDataCallback CRXCALLBACK as) class as integer End Function   

Finally a form

  private sub CRX_Load (ByVal As a system, Object, By as an E-system. Avent Aggers) MyBase handles. Load if CRX.CRX_Open (on Misses Reader Callback) & lt; & Gt; CRX_ERR_SUCCESS Then MessageBox.Show ( "CRX_Open Failed") End Sub Private Function MrzReaderCallback (ByVal pRecvBuff as System.IntPtr, ByVal nDataLen string as integer) as Dim str As Integer = Marshal.PtrToStringUni (pRecvBuff) MsgBox (STR) try to catch former exception MsgBox (ex.Message, MsgBoxStyle.Critical, "error") end return try CRX_ERR_SUCCESS   

but when I Using martial pRecvBuff content. PtrToStringUni (pRecvBuff, nDataLen) Returns are not readable to me characters

There is no suggestion for me, what am I doing wrong?

Relationship

Evan

Expect buffer (< Code> IntPtr ) to include a unicode string comprising a byte array.

If C + + API was not using Unicode, you may need it or in its replacement.

No comments:

Post a Comment