Link to home
Start Free TrialLog in
Avatar of mhw8
mhw8

asked on

Using callbacks from unmanaged library in VB.net

I am trying to use a callback from an unmanaged library(someapp.dll) in a new VB.net (3.5) application(myapp.exe). someapp.dll has an exported function for setting the callback function of an observing application. Back in the day of VB6, the call back function was registered in myapp.exe as follows:

Declare Function SetCallbackFunction Lib "someapp.dll" (funcID as long) As Long
Public sub SomeFuncCbk(value as long)
    do some stuff here
end sub

sub main
   SetCallbackFunction (AddressOf SomeFuncCBK)
end sub

With the above, SomeFuncCbk would receive callbacks from someapp.dll for relevant events. In VB.net, AddressOf does not generate a Long as it did in VB6. Is there a .Net equivalent that I can use? Any help would be appreciated.

-Mark
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial