Page 1 of 1

Got example of VB .Net code for UUIRTSetReceiveCallback ?

PostPosted: Tue Jan 08, 2008 4:13 pm
by patkevin
I'd be really grateful for an example of working VB .Net code that demonstrates use of the SetReceiveCallback method -or- any feedback on what might be wrong in the code below.

The code below compiles and the Open is successful and the SetReceiveCallback method is executed and then I aim the remote at the USB-UIRT and press a button and then the application terminates abnormally with the message "VHOST.EXE has stopped working".

I had Googled UUIRTSetReceiveCallback and VB .Net and found some info about using Delegate to setup a function pointer but could not find a full code example and my guesses about coding it haven't worked.

Thanks !
Patrick

================================

Private Sub MyCallbackSub(ByVal sData As Long, ByVal lNumber2 As Long)
(code here)
End Sub

Public Delegate Sub MyDelegateSub(ByVal sData As Long, ByVal lNumber2 As Long)

Dim MyCallbackSubInstance As MyDelegateSub

MyCallbackSubInstance = AddressOf MyCallbackSub

Public Declare Function UUIRTSetReceiveCallback Lib "uuirtdrv.dll"
(ByVal hHandle As Long, ByVal pReceiveProc As MyDelegateSub, ByVal userData As Form) As Long

UIRT_Handle = UUIRTOpen()

lRetCode = UUIRTSetReceiveCallback(lUIRT_Handle, MyCallbackSubInstance, Me) ' Me refers to the form (?)