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

So, my question is, how do I pass variables to a VB callback routine?