Hi,
Tried searching Google on this topic but not many came up. Basically I
have a C# GUI client that wants to receive 'notifications' from a worker DLL
(which is implemented in C++/CLI). So far, from C# I am able to call any
method directly in C++/CLI DLL. But I would like to have the C++/CLI invoke
some callback methods from within C# (some event notifications so that the
GUI updates its UI).
In the old days using C/C++, I could do this easily by passing a class
object ptr to the DLL and have it invoke callback methods declared in that
class. Can I do the same thing in .NET? Since there is no header file, I
don't know how to 'tell' the C++/CLI component which C# callback methods to
use. Thanks. 2 5181
John,
Basically, you would define a separate assembly where you define the
delegate that is used for the callback (or an interface, if you need a more
elaborate contract).
Then, you would reference the callback from the client and in your C++
code, and expose the a parameter type/property/field which would receive the
callback in the C++ code. Then, you can just execute the delegate when
needed (or the member on the interface, if that is the way you are going).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"John Doe" <jo**@doe.comwr ote in message
news:5A******** *************** ***********@mic rosoft.com...
Hi,
Tried searching Google on this topic but not many came up. Basically I
have a C# GUI client that wants to receive 'notifications' from a worker
DLL (which is implemented in C++/CLI). So far, from C# I am able to call
any method directly in C++/CLI DLL. But I would like to have the C++/CLI
invoke some callback methods from within C# (some event notifications so
that the GUI updates its UI).
In the old days using C/C++, I could do this easily by passing a class
object ptr to the DLL and have it invoke callback methods declared in that
class. Can I do the same thing in .NET? Since there is no header file, I
don't know how to 'tell' the C++/CLI component which C# callback methods
to use. Thanks.
you can fire some events in C++/CLI and handle these events in C#
--
Sheng Jiang
Microsoft MVP in VC++
"John Doe" <jo**@doe.comwr ote in message
news:5A******** *************** ***********@mic rosoft.com...
Hi,
Tried searching Google on this topic but not many came up. Basically
I
have a C# GUI client that wants to receive 'notifications' from a worker
DLL
(which is implemented in C++/CLI). So far, from C# I am able to call any
method directly in C++/CLI DLL. But I would like to have the C++/CLI
invoke
some callback methods from within C# (some event notifications so that the
GUI updates its UI).
In the old days using C/C++, I could do this easily by passing a class
object ptr to the DLL and have it invoke callback methods declared in that
class. Can I do the same thing in .NET? Since there is no header file, I
don't know how to 'tell' the C++/CLI component which C# callback methods
to
use. Thanks. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Melissa Wallis |
last post by:
I have a class with 5 callbacks. Two of the callbacks work fine but the
others don't. The main difference is that the callbacks that don't work are
composed of a sequence of structs. I noticed a comment about this same
problem on the web but no solution was noted. What makes the callbacks with
the sequences so different? It seems that when one of the callbacks with a
sequence is called it just hangs. I am talking to a TAO orb from...
|
by: Marwan |
last post by:
Hello
I am using asynchronous delegates to make a call to a COM ActiveX object, but even though the call occurs on a separate thread, my UI is still blocking.
If i put the thread to sleep in my delegate call, the application is well behaved (no UI freeze), but the call to the com object causes the UI to lock up
Do I have to manage calls to an ActiveX object differently than using the BeginInvoke and a callback
A sample of the code I...
|
by: ck388 |
last post by:
For some reason when I enable the callback feature of the gridview I
still get a page refresh, that is it seems like there is a postback
that occurs, not a callback which is just supposed to update not the
whole page, but a portion of the page.
Strangely enough the URL below
http://beta.asp.net/QUICKSTARTV20/aspnet/doc/ctrlref/data/gridview.aspx
(VB GridView Paging and Sorting Callbacks example)
|
by: Christopher Jastram |
last post by:
I'm a self-taught programmer, so this might be a pretty dumb question.
If it is, please point me in the right direction and I shall
apologize profusely.
I have a question regarding C++ and object members. Can anyone help?
I'm writing a C++ wrapper for a fairly old programming interface to a
document editing program that has no OOP whatsoever; only tons of
structs. This program has different callbacks I'm supposed to
implement for...
|
by: R. van der Welle |
last post by:
Hi All,
I am upgrading my app (working well with VB6) to VB.NET. It sends MIDI
messages using the API multimedia winmm.dll .
These functions are declared:
Public Declare Function timeSetEvent Lib "winmm.dll" (ByVal uDelay As
Integer, _
ByVal uResolution As Integer, ByVal lpFunction As MidiPlayDelegate, _
ByVal dwUser As Integer, ByVal uFlags As Integer) As Integer
| |
by: anilkoli |
last post by:
I want clear cut idea about callbacks and also of delegates
I have doughts about callbacks,
I feel callbacks are used for
1. recursion
2. dynamically calling a perticular method out of
many methods,
deciding at runtime.
3. Notification
|
by: HolyShea |
last post by:
All,
Not sure if this is possible or not - I've created a class which
performs an asynchronous operation and provides notification when the
operation is complete. I'd like the notification to be performed on
the same thread thread that instantiated the class. One way to do this
is to pass an ISynchronizeInvoke into the class and use it to
synchronize the callback. In the constructor of the class, could I
take note of the current thread...
|
by: dennis.richardson |
last post by:
Greetings all.
Here's a problem that's been driving me nuts for the last 48 hours.
I'm hoping that someone has come across this before.
I have a C# Application that reads a UDP broadcast (asynchronously).
Then it repackages these UDP packets and sends them to a subscriber
via TCP.
Now, I can read the UDP stream all day long without the application
|
by: Simon |
last post by:
I heard that we could do that by using AJAX. Could anybody share how to do
it? Thanks.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |