Calling a VB function from within a C++ DLL interrupt 
Author Message
 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,


Sun, 04 Jun 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. call another DLL from within a C++ DLL

2. Calling a C++ DLL function which takes an C++ object as parameter

3. VB 5.0 calling C++ 5.0 DLL that calls winsock.dll

4. VB calling C++ Dll function twice?

5. Calling a VB function/procedure from Visual C++ DLL

6. Calling a function in a C++ Win32 Dll from VB 6

7. Calling a VB function from a C++ DLL

8. calling C++ dll from VBScript within ASP

9. creating a callback function in c++ dll to callback a VB function in an exe

10. Calling VBA dll functions with C or C++

11. How do you call a Visual C++ (DLL) function from Visual Basic

12. Calling Visual C++ 5.0 DLL Functions From Visual Basic 5.0


Powered by phpBB® Forum Software