I am trying to do a callback from my C++ dll to a VB program
I define the callback function pointer like so
VB declares a function that exists in the dll and passes it the Addressof MyCallback as longCode:typedef void ( __stdcall *PFNODSCALLBACK)(PSTR pszString);
The callback function is defined as:
later on in the dll it's called like thisVB Code:
Public Sub MyCallBack(ByVal lpDebug As Long) Form1.logevent "Debug Output: " & Hex(lpDebug) End Sub
Now, the callback is being made, but if I try to access the variable passed back I get a GPF.Code://defined earlier PFNODSCALLBACK m_pfnODSCallback; //defined and initialized somewhere char szBuffer[ 1024 ]; //call the VB callback function m_pfnODSCallback( szBuffer );
So, my question is, how do I pass variables to a VB callback routine?




Reply With Quote