I have looked through the Help stuff till I'm blue in the face.
The only 'AddressOf' examples dealing with a delegate for a Function do not
show the original Function in question. The following is my attempt which
fails.
Delegate Function DeviceAttachDelegate(ByVal hDevice As Integer, ByRef
pDeviceInfo As WDU_DEVICE, _
ByRef pUserData As DEVICE_CONTEXT) As Integer
Public Function DeviceAttach(ByVal hDevice As Integer, ByRef pDeviceInfo
As WDU_DEVICE, _
ByRef pUserData As DEVICE_CONTEXT) As Boolean
The DeviceAttach ( and DeviceDetach) function is a callback from a 3rd party
dll so must be exact. To set up the callback address it must be presented to
an API call as an Integer address (Yep, worked in VB6)
Public Sub SetEventTable(ByRef eventTable As WDU_EVENT_TABLE)
eventTable.pfDeviceAttach = AddressOf DeviceAttach
eventTable.pfDeviceDetach = AddressOf DeviceDetach
End Sub
and the error shown is
'AddressOf' expression cannot be converted to 'Integer' because
'Integer' is not a delegate type.
It's obvious I'm doing something way wrong. Probably need some pinvoke type
stuff. I would appreciate some guidance here.
GalenS