all groups > dotnet interop > june 2007 >
You're in the

dotnet interop

group:

C# control needs to notify C++ application



C# control needs to notify C++ application aaron.m.johnson NO[at]SPAM gmail.com
6/27/2007 10:09:41 PM
dotnet interop: 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?
Re: C# control needs to notify C++ application Ben Voigt [C++ MVP]
6/29/2007 2:36:39 AM

[quoted text, click to view]

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.
AddThis Social Bookmark Button