Reference from VB6 Function

L

Lou

I need to have a C# funtion that has one parameter which is a VB6 function
pointer.
How do i declare the variable for the function pointer in C#?
I am using ptrFunction in the example below.
What do i replace that with?
I need to call back into the vb6 app.


Example:
C# Function
public void GiveMeAReference{ptrfunction myFunctionPointer){

}

vb6 Function:
Private Sub Command1_Click()
myDLL.GiveMeAReference AddressOf myFunction
End Sub

-Lou
 
M

Mattias Sjögren

Lou,
I need to have a C# funtion that has one parameter which is a VB6 function
pointer.

Why do you (think you) need to use function pointers directly? Why not
use a COM interface for callbacks?



Mattias
 
L

Lou

I could not get Events to work. I created a Comm interface for my C# dll.
The events in C# showed up correctly in the C# object browser, but in VB6
they did not show up as Events in the object browser(Ligthning symbols) but
as methods??
so I figured I would pass a refernce to my callback function in VB6??

-Lou
 
M

Mattias Sjögren

so I figured I would pass a refernce to my callback function in VB6??

Events should work, but you don't necessarily have to use them. You
could just define an interface that the C# class implements and that
the VB6 code uses for callbacks.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top