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_LONG Timeout;

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.


Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mr_EziAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.