[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

C# control needs to notify C++ application

aaron.m.johnson

6/27/2007 10:10:00 PM

I'm writing a C# control that needs to be able to notify the parent
application of certain events. If the application were also using
the .NET platform I'd just use a delegate. Unfortunately the
application is writen in unmanaged C++.

Is there some way for me to send a message or execute a callback from
the control that the application can process?

1 Answer

Ben Voigt [C++ MVP]

6/29/2007 7:37:00 AM

0


<aaron.m.johnson@gmail.com> wrote in message
news:1182982181.058574.225460@a26g2000pre.googlegroups.com...
> I'm writing a C# control that needs to be able to notify the parent
> application of certain events. If the application were also using
> the .NET platform I'd just use a delegate. Unfortunately the
> application is writen in unmanaged C++.
>
> Is there some way for me to send a message or execute a callback from
> the control that the application can process?
>

For a GUI control, post a notification message to the parent window (see
WM_NOTIFY, BN_CLICKED for example).

For non-GUI components, a function pointer is much like a delegate.
Remember to include an extra parameter set at the time of subscription,
sizeof void* or larger, for the caller to pass his "this" pointer or some
other data he wants.