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

Using AddressOf to call function in VC++ DLL from VB

Been given a third party DLL written in Visual C++
This DLL have a method to enable a client to give the address of a callback method.
A DLL's background thread calls the client's callback when some events occur.

I am given the following details, not sure what to make of it since i do not know VC++ :-
int openDevice(int typ, CALLBACKBCOM cbf, void* param=NULL)
where the parameters
cbf specifies the user callback procedure with definition: typedef void (CALLBACKCOM)(int nStatus, int nTracks)

How can i write a VB program to get data making use of the operator AddressOf? I am not familiar with VB's CallBack although i have gone through some samples on this site.

Some sample code would be appreciated.

Thanks,
Joanne
0
BSKhoo
Asked:
BSKhoo
1 Solution
 
EDDYKTCommented:
how about

Public Sub callback_function(ByVal nStatus As Long, ByVal nTracks As Long)
     ' Do your stuff
End Sub

dim Ret as long

Ret = openDevice(1, AddressOf (callback_function))
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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