I have a class Derived from CDialog (CNotificationDialog) which is auto-generated by Visual Studio when selecting the Add Class option.
I also have another class that's derived from CNotificationDialog (CWebNotificationDialog).
My code is something like:
CNotificationDialog* dlg = new CWebNotificationDialog();
dlg->Display();
The dialog is displayed but the CWebNotificationDialog::OnInitDialog method is not called. Only the CNotificationDialog::OnInitDialog method is called.
And before you ask, YES it is declared virtual. I've alos tried adding DECLARE_DYNAMIC, BEGIN_MESSAGE_MAP and all the other macros that are auto-generated, but no luck.
What am I doing wrong?
This is what CNotificationDialog::OnInitDialog looks like.
BOOL C1NotificationDialog::OnInitDialog()
{
CDialog::OnInitDialog();
HICON hIconBig = (HICON)LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 32, 32, LR_SHARED);
CStatic *pPictureCtrl = (CStatic*)GetDlgItem(IDS_NOTIFICATION_DLG_LOGO);
pPictureCtrl->SetIcon(hIconBig);
return TRUE;
}
It's declared like this:
protected:
virtual BOOL OnInitDialog();