Show dialog window in PreCreateWindow(..) failed :(
-
I want to show dialog window (with image) for 3 seconds befor my project will start. I use Timer with aim to destroy dialog window in 3 seconds
BOOL CRightHTMLView::PreCreateWindow(CREATESTRUCT& cs) { dlg = new CDialog(IDD_ABOUTBOX, this); // dlg is a member variable of CRightHTMLView MSG message; int i=0; m_nTimer = SetTimer(1, 100, NULL); // Here Debug Assertion Failed! ASSERT(m_nTimer!=0); if(i==0) { dlg->DoModal(); if(::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&message); ::DispatchMessage(&message); } i = 1; } return CHtmlView::PreCreateWindow(cs); } void CRightHTMLView::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default Sleep(3000); dlg->DestroyWindow(); KillTimer(1); CHtmlView::OnTimer(nIDEvent); }
What is wrong in my function(s)? If anybody knows how to display image in other way (not in dialog window), please share here with your ideas. I would appreciate your co-operation. Aleksey. -
I want to show dialog window (with image) for 3 seconds befor my project will start. I use Timer with aim to destroy dialog window in 3 seconds
BOOL CRightHTMLView::PreCreateWindow(CREATESTRUCT& cs) { dlg = new CDialog(IDD_ABOUTBOX, this); // dlg is a member variable of CRightHTMLView MSG message; int i=0; m_nTimer = SetTimer(1, 100, NULL); // Here Debug Assertion Failed! ASSERT(m_nTimer!=0); if(i==0) { dlg->DoModal(); if(::PeekMessage(&message, NULL, 0, 0, PM_REMOVE)) { ::TranslateMessage(&message); ::DispatchMessage(&message); } i = 1; } return CHtmlView::PreCreateWindow(cs); } void CRightHTMLView::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default Sleep(3000); dlg->DestroyWindow(); KillTimer(1); CHtmlView::OnTimer(nIDEvent); }
What is wrong in my function(s)? If anybody knows how to display image in other way (not in dialog window), please share here with your ideas. I would appreciate your co-operation. Aleksey.In
PreCreateWindow()
your window hasn't been created yet (thus the "pre" in the name) so you can't do things like set timers or pump other messages that rely on window handles. --Mike-- LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD