I am supposed to be passing the address of my managed function to the unmanaged code. So here's what I do:
'Create my delegate
Public Delegate Sub CameraAdded(ByRef useData As IntPtr)
'Wrap the unmanaged function
Declare Auto Function KSetCameraAddedNotification Lib "DCSPro4SLR.dll" Alias "KPDCSetCameraAddedNotification" (ByRef inManagerRef As IntPtr, ByRef inNotificationFunc As CameraAdded, ByRef inUserData As IntPtr) As Integer
'Here's my function I want the unmanaged code to call
'This is designed according to the documentation.
Private Sub CameraAddedEvent(ByRef userData As IntPtr)
'//This event handles the camera added events.//
RaiseEvent NewFile("Hey, it fired CameraAddedEvent.")
End Sub
'And in my New I pass the address of my function to the unmanaged code.
Public Sub New()
myStatus = Me.KInitialize(Me.KPDCInitalizationOptions.KPDCInitOptionEnableIEEE1394, Me.myLibMgr)
'Tell Kodak what function to call when there is a Camera Added Event
myStatus = Me.KSetCameraAddedNotification(Me.myLibMgr, AddressOf Me.CameraAddedEvent, somePtr)
End Sub
When the event does happen, my code never get's called. Am I passing the address wrong?
The definition of KSetCameraAddedNotification calls for the second parameter to be of type KPDCCameraAddedNotificationFunc. That type is defined like so:
#define KPDCCALLBACK CALLBACK
typedef void (KPDCCALLBACK *KPDCCameraAddedNotificationFunc)(void *userData);
I'm trying to use VB, this is C++. I don't know what to do or where to look and I'm sure you guys are tired of me bugging you.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.