|
In InitInstace after OnFileNew() called, its was found m_phWnd is null. OnFileNew() is default implementation of mfc.
Please help me out.
|
|
|
|
|
You should provide more information to get help. Use the 'Edit' link below your post to do this (e.g. add a short code snippet).
What is the class for m_phWnd (there is no CWinApp member with this name?
|
|
|
|
|
Actually I had wrongly mention the member name, it is m_pMainWnd.
I am sorry, I cannot provide the code snippet.
|
|
|
|
|
m_pMainWnd is not set by MFC. It is provided to be used in your code. Common usage is to assign the address of your main frame window (or the main dialog with dialog based applications) upon creation in InitInstance() :
CMyApp::InitInstance()
{
...
CMainFrame * pMainFrame = new CMainFrame;
if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
m_pMainWnd = static_cast<CWnd*>(pMainFrame);
...
}
Purpose is to have access to your main frame class from all modules of your app:
CMainFrame * pMainFrame = static_cast<CMainFrame*>(AfxGetApp()->m_pMainWnd);
|
|
|
|