I dynamically create some ActiveX controls in my MFC app. I want to handle their event such as click, dblclick. But I don't know what kind of message should I catch where to put the code to catch them. I can add the event handler if I put the these control on the dialog window as I design the GUI. The code automatically added by MFC is below:
BEGIN_EVENTSINK_MAP(CButtonMsgDlg, CDialog)
ON_EVENT(CButtonMsgDlg, IDC_CWBOOLEAN1, DISPID_DBLCLICK, CButtonMsgDlg::DblClickCwboolean1, VTS_NONE)
END_EVENTSINK_MAP()
void CButtonMsgDlg::DblClickCwboolean1()
{
// TODO: Add your message handler code here
}
// TODO: Add your message handler code here
seems like a pretty good indication to me. You can do the same thing for dynamically created controls just manually add ON_EVENT/ON_COMMAND/etc with the id you will use in the control creation. You can also use a range of ids if needed. – AJG85