Article ID: 181578
Article Last Modified on 6/29/2004
Private Declare Sub ExecuteCallback Lib "vcvbdll" ( _
ByVal pFunc as Long)
Call ExecuteCallback(AddressOf MyCallback)
Sub MyCallback(ByVal parm as String)
MsgBox "You are inside the VB callback function!"
MsgBox "Parameter passed in was: " & parm
End Sub
void __stdcall ExecuteCallback(long cbAddress) {
// Declare the function pointer, with one string argument.
typedef void (__stdcall *FUNCPTR)(BSTR pbstr);
FUNCPTR vbFunc;
// Point the function pointer at the passed-in address.
vbFunc = (FUNCPTR)cbAddress;
// Call the function through the function pointer.
vbFunc(SysAllocString(L"Hi! This message came from your DLL!"));
}
ExecuteCallback
171729 : How To Do Generic Callbacks Using a Helper DLL
Additional query words: kbVBp500 kbVC500 kbVBp kbDSupport kbdsd kbDLL
Keywords: kbhowto KB181578