• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

Pointer to callback in VB.net

I'm working with an SDK to integrate with a Biometric device.

Now I'm stuck with this callback I have no idea how I need to implement that.
 
typedef struct abs_operation {
ABS_DWORD OperationID;
void* Context;
ABS_CALLBACK Callback;
ABS_LONG Timeout;
ABS_DWORD Flags;
} ABS_OPERATION

Open in new window

This code I tried is throwing me an “attempt to writ e to protected memory” error.
 Not workingAny help is appreciated.

Thanks

Docs.PNG
0
Mr_Ezi
Asked:
Mr_Ezi
1 Solution
 
x77Commented:
You can declare a new class on your Vb code:

Public Delegate Sub Abs_Callback() 'You need know about Abs_callback parameters
Class abs_operation
    Public OperationID As Integer ' ABS_DWORD -  32 bit ?
    Public Context As Byte()    ' void* - pass a byte array as documentation ...
    Public Callback As Abs_Callback 'ABS_CALLBACK
    Public Timeout As Long ' ABS_LONG
    Public Flags As Integer ' ABS_DWORD ;
End Class

Then Initialize it:

  Dim abs_operation As New abs_operation With _
      {.OperationID = 1, .Context = New Byte(256) {}, _
      .callback = AddressOf myCalBackProc, _
      .Timeout = 100}

Note: I do´nt know about exact type for ABS_DWORD, long ..., also for context you can use a string or a initialized StringBuilder.

myCalBackProc is a method on your code that matches parameters as declarated delegate.
0
 
Mr_EziAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now