Mattias Sjögren said:
VB6 also targets Win32 so I don't see how it could work there.
If you're running .NET 2.0 you can try calling
Marshal.GetFunctionPointerForDelegate(), truncate the result to
16-bits and see if it works.
Mattias
My bad. In VB2005 it would be integer not short
VB6 code in bas module. The Call SetEventTable is immediately followed by
the 3rd party dll call WDU_Init
Dim eventTable As WDU_EVENT_TABLE
Call SetEventTable(eventTable, AddressOf DeviceAttach, AddressOf
DeviceDetach)
eventTable.pUserData = WD_VB_GetAddress(DevCtx, 1, 1)
dwError = WDU_Init(hdriver, matchTable, 1, eventTable, _
DEFAULT_LICENSE_STRING, WD_ACKNOWLEDGE, hWnd)
VB6 driver code bas module. It would appear that the AddressOf's could be
left out of the SetEventTable call and placed directly after the ='s below.
Public Sub SetEventTable(ByRef eventTable As WDU_EVENT_TABLE, ByVal attachCb
As Long, _
ByVal detachCb As Long)
eventTable.pfDeviceAttach = attachCb
eventTable.pfDeviceDetach = detachCb
End Sub
Public Type WDU_EVENT_TABLE
pfDeviceAttach As Long
pfDeviceDetach As Long
pfPowerChange As Long
pUserData As Long
End Type
VB6 declares for callback procedures
Public Function DeviceAttach(ByVal hDevice As Long, ByRef pDeviceInfo As
WDU_DEVICE, _
ByRef pUserData As DEVICE_CONTEXT) As Boolean
Public Sub DeviceDetach(ByVal hDevice As Long, ByRef pUserData As
DEVICE_CONTEXT)
GalenS