Sign in to follow this  
spek

C++ DLL CallBacks to VB.Net application lost

Recommended Posts

Hi, On a Windows CE device, I have a VB.Net program running, and a C++ DLL that hooks with the keyboard. This DLL seperates barcodes from normal key input. It works fine, until I open a certain form in my VB.net application. For some reason, the DLL stops calling my application when a barcode was received. The strange thing is that I can restore it by sending the function pointers to my VB callbacks again. So, I guess that either the CPP DLL looses his pointers to my VB.Net functions, or the VB.Net callbacks change address. VB.Net
Public Delegate Sub WEDGE_BarcodeCallBack(ByVal barcode As String)
...
<init the callbacks for the C++ DL>
DLL_SetCallBacks( addressOff( functionX ) )
...
// function X gets called, until a certain form is opened in this app. then
// I'll have to set the callback again
CPP DLL
typedef void (__stdcall *WEDGE_BarcodeCallBack)( BSTR str );
WEDGE_BarcodeCallBack barcodeCallBack;
...
void DLL_SetCallBacks( const long _callBackFunction )
{
   barcodeCallBack = (WEDGE_BarcodeCallBack)_callBackFunction;
   ...
}   
Any idea why this happens? Greetings, Rick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this