Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Show dialog window in PreCreateWindow(..) failed :(

Show dialog window in PreCreateWindow(..) failed :(

Scheduled Pinned Locked Moved C / C++ / MFC
questiondebuggingtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bilas
    wrote on last edited by
    #1

    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.

    M 1 Reply Last reply
    0
    • B bilas

      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.

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups