I've created an MFC dialog application. I added an MFC
Class CMyWnd derived from generic CWnd. I then manually
changed derived class to CMDIFrameWnd where appropriate.
On InitInstance I have the following code:
AfxMessageBox("About to create the window");
CRect rect(200,200, 1000,1000);
CMyWnd* pMainFrame = new CMyWnd; // assertion failure here
if( !pMainFrame->Create(NULL, _T("Title"), WS_OVERLAPPEDWINDOW|WS_VSCROLL|WS_VISIBLE|WS_SYSMENU|WS_THICKFRAME, rect, NULL, MAKEINTRESOURCE(IDR_MAIN), NULL, NULL)) // assertion failure here
HINSTANCE h = theApp.m_hInstance;
HICON ico =::LoadIcon(h, MAKEINTRESOURCE(IDR_MAIN));
BOOL bBigIcon = FALSE;
AfxMessageBox("about to update the window");
m_pMainWnd = pMainFrame;
I am getting two assertion failures as shown above.
What am I doing wrong?
I should add that on ignoring the assertion failures the
window is shown as expected, with menu, icon etc.