Win32 controls do typically post WM_NOTIFY messages to the parent window for user events. The Measurement Studio UI controls are actually ActiveX controls, though, and events are handled differently for ActiveX controls.
If you have a resource ID for you control, the easiest way would be to create your control in the OnInitDialog method and handle the event the same way you would if you had added the control to the dialog at design-time:
- Add a declaration for the event handler in the AFX_MSG block in the dialog header file.
- Make sure the AFX_MSG block in the header file includes DECLARE_EVENTSINK_MAP()
- Include an ON_EVENT entry for the event in the dialog source's BEGIN_EVENT_SINK_MAP block.
- Include a DDX_Control entry
in the dialog source's AFX_DATA_MAP block.
Otherwise, you'll have to dynamically sink the event at runtime after you've created the control. Microsoft's Knowledge Base has a couple of good articles that demonstrate how to do this:
SAMPLE: AtlEvnt.exe Creates ATL Sinks Using IDispEventImpl (Q194179) AtlSink Uses ATL to Create a Dispinterface Sink (Q181277)- Elton