m_pMainWnd is NULL in CWinApp::Run
-
Hi, In my app::InitInstance()
{ ... CMyDlg dlg; m_pMainWnd = &dlg; dlg.DoModal(); return TRUE; } The 'CMyDlg' has an internal timer that gets activated after 1 second, and starts executing some actions. After done, the timer is killed and 'CDialog::OnOK' is called. This gets the dialog closed. In the app i need to return TRUE, else i got exit code != 0. But now, i get this ennoying warning: Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application. Any way to get this (annoying) warning out of the program? Greetings, Jens
-
Hi, In my app::InitInstance()
{ ... CMyDlg dlg; m_pMainWnd = &dlg; dlg.DoModal(); return TRUE; } The 'CMyDlg' has an internal timer that gets activated after 1 second, and starts executing some actions. After done, the timer is killed and 'CDialog::OnOK' is called. This gets the dialog closed. In the app i need to return TRUE, else i got exit code != 0. But now, i get this ennoying warning: Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application. Any way to get this (annoying) warning out of the program? Greetings, Jens
"Typically, you set this member variable when you override InitInstance. In a worker thread, the value of this data member is inherited from its parent thread." Can you show the complete code for
InitInstance
up todlg.DoModal();
? Also, why are you writing to this variable? The tigress is here :-D -
Hi, In my app::InitInstance()
{ ... CMyDlg dlg; m_pMainWnd = &dlg; dlg.DoModal(); return TRUE; } The 'CMyDlg' has an internal timer that gets activated after 1 second, and starts executing some actions. After done, the timer is killed and 'CDialog::OnOK' is called. This gets the dialog closed. In the app i need to return TRUE, else i got exit code != 0. But now, i get this ennoying warning: Warning: m_pMainWnd is NULL in CWinApp::Run - quitting application. Any way to get this (annoying) warning out of the program? Greetings, Jens
Dialog based apps must return
FALSE
from their CWinApp::InitInstance function.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
Dialog based apps must return
FALSE
from their CWinApp::InitInstance function.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!
-
Hi, I tried to return false, but then the exit-code of the process is '1'. The exit-code needs to be '0'. I removed the m_pMainWnd = &dlg; line alsoo. Greetings, Jens -- modified at 9:40 Monday 12th September, 2005
You need to use:
BOOL CMyDialog::InitInstance()
{
return FALSE; // so that the application's message pump doesn't start
}int CMyDialog::ExitInstance()
{
return 0; // the application's exit code
}
"One must learn from the bite of the fire to leave it alone." - Native American Proverb