473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Reference from VB6 Function

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


Nov 15 '05 #1
4 3066
Lou
Oh yea, once i have my function ptr, how do i call back to VB6 with it?
"Lou" <lo********@comcast.net> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
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

Nov 15 '05 #2
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #3
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
"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:eZ**************@TK2MSFTNGP12.phx.gbl...
Lou,
I need to have a C# funtion that has one parameter which is a VB6 functionpointer.


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

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Nov 15 '05 #4
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

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on...
110
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
2
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is...
51
by: Kuku | last post by:
What is the difference between a reference and a pointer?
3
by: Michael Sgier | last post by:
Hi i get thousands of messages like below. How shall i resolve that? Thanks Mcihael Release/src/Utility/RawImage.o: In function `CMaskImage::CMaskImage(int, int, char const*)':...
29
by: shuisheng | last post by:
Dear All, The problem of choosing pointer or reference is always confusing me. Would you please give me some suggestion on it. I appreciate your kind help. For example, I'd like to convert a...
10
by: Robert Dailey | last post by:
Hi, I noticed in Python all function parameters seem to be passed by reference. This means that when I modify the value of a variable of a function, the value of the variable externally from the...
3
by: George2 | last post by:
Hello everyone, 1. Returning non-const reference to function local object is not correct. But is it correct to return const reference to function local object? 2. If in (1), it is correct...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.