<aaron.m.johnson (AT) gmail (DOT) com> wrote
Quote:
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.