
Calling a VB function from within a C++ DLL interrupt
Hi all,
I know the VB-DLL issue comes up every second hour on this newsgroup,
but I think this is a varient that I haven't seen addressed (nor could
I find anything after searching the net)
I have a 32bit DLL receiving data from a hardware device that generates
interrupts. The data is buffered and VB5 must poll the DLL to tell if
there is new data and then retrieve it. I want to pass a pointer to
a VB function such that, when the interrupt occurs, the DLL calls the
VB function directly. Is this a good way to do this? Is there a
better way?
My test program uses the VB declare
Private Declare Function sendfunc Lib "d:\bc5\bin\sample4.dll" _
(ByVal hwnd As Long) As Integer
with the function declared in a module as
Function test()
Form1.Text1 = "It worked!"
End Function
And a command button to start the process
Private Sub Command3_Click()
a = sendfunc(AddressOf test)
End Sub
My C program function (so far looks like this)
extern "C"
int __declspec(dllexport) WINAPI sendfunc(???)
What does a pointer to a VB function look like?
How do I call the function?
Any pointers (pun intended) are appreciated,
Steve