- Joined
- Dec 3, 2008
- Messages
- 2
- Reaction score
- 0
I have a code example from a company that sells software used to automate cameras. The C# code consists of the following pieces:
private OnImageNotificationDelegate OnImageReceivedCallback;
OnImageNotificationDelegate is defined
public delegate void OnImageNotificationDelegate(HermesImage image, int userData, IntPtr userPtr);
OnImageReceivedCallback is invoked:
OnImageReceivedCallback = new OnImageNotificationDelegate(OnImageReceived);
After that, OnImageReceived, which is declared below, is called when each frame arrives.
public void OnImageReceived(HermesImage image, int userData, IntPtr userPtr)
{
//System.Diagnostics.Trace.WriteLine("DemoGrab - OnImageReceived");
LastImage = image;
if(SequenceReady)
SampleSequence.Write(image);
Invalidate(false);
}
When translated into Visual Basic.NET (VB.NET 2008), we tried this:
Private OnImageReceivedCallBack As OnImageNotificationDelegate
or
Private OnImageReceivedCallBack As NorPix.HermesNET.OnImageNotificationDelegate ' fully qualified
then
OnImageReceivedCallBack = New OnImageNotificationDelegate(AddressOf OnImageReceived)
This is how we translated the subroutine:
Public Sub OnImageReceived(ByVal Image As HermesImage, ByVal userData As Integer, ByVal userPtr As IntPtr)
LastImage = Image
...
End Sub
The problem is that the subroutine, OnImageReceived, is never called, and we simply do not understand why.
Any ideas would be appreciated.
Rick
private OnImageNotificationDelegate OnImageReceivedCallback;
OnImageNotificationDelegate is defined
public delegate void OnImageNotificationDelegate(HermesImage image, int userData, IntPtr userPtr);
OnImageReceivedCallback is invoked:
OnImageReceivedCallback = new OnImageNotificationDelegate(OnImageReceived);
After that, OnImageReceived, which is declared below, is called when each frame arrives.
public void OnImageReceived(HermesImage image, int userData, IntPtr userPtr)
{
//System.Diagnostics.Trace.WriteLine("DemoGrab - OnImageReceived");
LastImage = image;
if(SequenceReady)
SampleSequence.Write(image);
Invalidate(false);
}
When translated into Visual Basic.NET (VB.NET 2008), we tried this:
Private OnImageReceivedCallBack As OnImageNotificationDelegate
or
Private OnImageReceivedCallBack As NorPix.HermesNET.OnImageNotificationDelegate ' fully qualified
then
OnImageReceivedCallBack = New OnImageNotificationDelegate(AddressOf OnImageReceived)
This is how we translated the subroutine:
Public Sub OnImageReceived(ByVal Image As HermesImage, ByVal userData As Integer, ByVal userPtr As IntPtr)
LastImage = Image
...
End Sub
The problem is that the subroutine, OnImageReceived, is never called, and we simply do not understand why.
Any ideas would be appreciated.
Rick
Last edited: