473,847 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mixing managed/unmanaged C++ callback

DD
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:

Unmanaged
------------
Callback listener class with method that should call an event in managed
Form1.
Initialization code for the listener that launches the listener thread.

Managed
----------
Windows form application with a custom event handler.

I believe this can be broken down into three parts:

1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!
Nov 17 '05 #1
13 2280
> I'm puzzled how to mix managed/unmanaged C++ in the following scenario:

I am also wondering how to do this.
I tried this a few years ago but so far I have never been able to make it
work.
I cannot imagine that it is not somehow thought through by Microsoft.
Nov 17 '05 #2
> I'm puzzled how to mix managed/unmanaged C++ in the following scenario:

I am also wondering how to do this.
I tried this a few years ago but so far I have never been able to make it
work.
I cannot imagine that it is not somehow thought through by Microsoft.
Nov 17 '05 #3
I could send you a VS.NET solution containing projects that demonstrate this,
using C# and C++.
Let me know if you are interested.

-Clift Norris
"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:

1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #4
I could send you a VS.NET solution containing projects that demonstrate this,
using C# and C++.
Let me know if you are interested.

-Clift Norris
"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:

1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #5
On 2005-07-11, Clift Norris wrote:
I could send you a VS.NET solution containing projects that demonstrate this,
using C# and C++.
Let me know if you are interested.

-Clift Norris
Personally I would LOVE to see some samples of this. Would you
mind emailing them to me? My email is:

account: scarleton
At the domain of: miltonstreet.co m

Thanks!

"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:

1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #6
On 2005-07-11, Clift Norris wrote:
I could send you a VS.NET solution containing projects that demonstrate this,
using C# and C++.
Let me know if you are interested.

-Clift Norris
Personally I would LOVE to see some samples of this. Would you
mind emailing them to me? My email is:

account: scarleton
At the domain of: miltonstreet.co m

Thanks!

"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:

1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #7
Ok, it is "in the email". I sent a zipped VS.NET solution.
-Clift
"Sam Carleton" wrote:
On 2005-07-11, Clift Norris wrote:
I could send you a VS.NET solution containing projects that demonstrate this,
using C# and C++.
Let me know if you are interested.

-Clift Norris


Personally I would LOVE to see some samples of this. Would you
mind emailing them to me? My email is:

account: scarleton
At the domain of: miltonstreet.co m

Thanks!

"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:
1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #8
Ok, it is "in the email". I sent a zipped VS.NET solution.
-Clift
"Sam Carleton" wrote:
On 2005-07-11, Clift Norris wrote:
I could send you a VS.NET solution containing projects that demonstrate this,
using C# and C++.
Let me know if you are interested.

-Clift Norris


Personally I would LOVE to see some samples of this. Would you
mind emailing them to me? My email is:

account: scarleton
At the domain of: miltonstreet.co m

Thanks!

"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:
1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #9
DD
Clift, it would be great if I could also receive the sample project. My
email is listed on this page, (click on the link for Dan K.)
http://www.autonvs.com/teamcontacts.html

"Clift Norris" <Cl*********@di scussions.micro soft.com> wrote in message
news:CC******** *************** ***********@mic rosoft.com...
I could send you a VS.NET solution containing projects that demonstrate
this,
using C# and C++.
Let me know if you are interested.

-Clift Norris
"DD" wrote:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario:
I believe this can be broken down into three parts:

1) How to call the managed code event in Form1 from unmanaged C++.
2) How to access Form1 (since it is an instance of a Form).
3) How to initialize the unmanaged callback listener from within Form1.

Thanks!

Nov 17 '05 #10

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

Similar topics

0
292
by: DD | last post by:
I'm puzzled how to mix managed/unmanaged C++ in the following scenario: Unmanaged ------------ Callback listener class with method that should call an event in managed Form1. Initialization code for the listener that launches the listener thread. Managed ----------
1
2606
by: H.B. | last post by:
Hi, I need to make a function that can display data on my Managed C++ app and be called by an unmanaged C++ DLL. Something like : void Form1::Form1_Load(System::Object * sender, System::EventArgs * e) { MyDLLInit(MyAppDisplayFunction); }
5
3420
by: Maxwell | last post by:
Hello, Newbie question here. I have a VS.NET 2003 MC++ (not C++/cli) project where I have a managed class reference in a unmanaged class...simple enough. To keep things short I am for the most part attempting to do what is this article by Nish: http://www.voidnish.com/articles/ShowArticle.aspx?code=cbwijw I have to hook up a unmanaged callback to a managed method using IJW NOT P\Invoke. So I am employing this "Thunk" or "Bridge" class...
7
2621
by: harishashim | last post by:
I am wrapping a digital camera API using Managed C++ VS .NET 2003). I have this function that called as bellow in the API sample. err = PR_RC_StartViewFinder( m_hCamera, //line 1 (prContext)this, //line 2 (prViewFinderCB*)&ViewFinderCallBackFun ); //line 3 prContext is actually a typedef for unsigned long. ViewFinderCallBackFun is a callback function. There is two error that I get when i tried above code unchanged:
1
2904
by: stillh2os | last post by:
Hello. I'm new to .NET, and I'm trying to implement a callback function. I want my managed C++ code to call an unmanaged function, passing in a callback function that the unmanaged C/C++ code will call. I'm getting Error 2664: cannot convert parameter 1 from CallBack __gc * to CUSTOM_HOOK_CALLBACK_FUNCTION. Here's what I have... In my unmanaged DLL -- Header file: --------------------------------------------------- typedef VOID...
0
1403
by: DavidT | last post by:
Hello, at first, exuse if the following question is simple to solve, but i normaly coding with C# and now have to use C++/CLI for one project. My Problem is that i have to use a native c++ sdk to read pictures from ip cameras. I get the native c++ decoder worked so far and now try to send callbacks from unmanaged to managed code, to signal wenn a picture is fully received. To get a first view on that area i implemented a little test...
8
2298
by: DavidT | last post by:
Hello, at first, exuse if the following question is simple to solve, but i normaly coding with C# and now have to use C++/CLI for one project. My Problem is that i have to use a native c++ sdk to read pictures from ip cameras. I get the native c++ decoder worked so far and now try to send callbacks from unmanaged to managed code, to signal wenn a picture is fully received.
9
3569
by: =?Utf-8?B?RWR3YXJkUw==?= | last post by:
I would greatly appreciate some help on passing managed object into unmanaged code. I need to pass a reference (address of) of a managed class into unmanaged code (written by a thrid party). The 3rd party unmanaged DLL will pass this reference into standard Win32 unmanaged static callback function in my code. Inside this unmanaged callback function I need to cast this unmnaged pointer that I have received from 3rd party back into the...
1
4545
by: Kenneth Porter | last post by:
I have an unmanaged library that can accept an instance of an abstract class and call back into it. I'm writing a wrapper for this library. How do I wrap a managed callback in a class derived from the unmanaged class to pass to the library? I tried creating a managed class that carries an unmanaged callback class which calls back into the managed class, but I can't put a handle to the unmanaged class in the unmanaged class. (I get...
0
9889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10988
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10712
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10344
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9487
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5914
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4536
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.