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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. error! repeatedly calling the same MFC dialog box in vc++

error! repeatedly calling the same MFC dialog box in vc++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
4 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.
  • S Offline
    S Offline
    shiva shankar
    wrote on last edited by
    #1

    i am doing project on vc++ MFC DIALOG, where in i will be repeatedly calling the same dialog box morethan 100 times, but the problem is, that the dialog box is getting crashed(terminating or ending) after some 50 times.. what can be the problem?

    J 1 Reply Last reply
    0
    • S shiva shankar

      i am doing project on vc++ MFC DIALOG, where in i will be repeatedly calling the same dialog box morethan 100 times, but the problem is, that the dialog box is getting crashed(terminating or ending) after some 50 times.. what can be the problem?

      J Offline
      J Offline
      Johan Rosengren
      wrote on last edited by
      #2

      jklhjk wrote: what can be the problem? Probably that you have a bug in your program. As you don't describe anything about what the dialog does, it's difficult to be more specific :-) Have you tried running it in debug mode, you ought to get some more info on the reason this way?

      S 1 Reply Last reply
      0
      • J Johan Rosengren

        jklhjk wrote: what can be the problem? Probably that you have a bug in your program. As you don't describe anything about what the dialog does, it's difficult to be more specific :-) Have you tried running it in debug mode, you ought to get some more info on the reason this way?

        S Offline
        S Offline
        shiva shankar
        wrote on last edited by
        #3

        There is no bug in program,the same program i can run it in (c language) cmd prompt.. i have check it out by creating new dialog box ("hello")having only "OK" Buttton in it. void CHelloDlg::OnOK() { // TODO: Add extra validation here CDialog::EndDialog(IDOK); CHelloDlg cmd(this); cmd.DoModal(); } after running it . keep pressing the "ok" button continously, the dialog box crashes or ends after 50 times..

        J 1 Reply Last reply
        0
        • S shiva shankar

          There is no bug in program,the same program i can run it in (c language) cmd prompt.. i have check it out by creating new dialog box ("hello")having only "OK" Buttton in it. void CHelloDlg::OnOK() { // TODO: Add extra validation here CDialog::EndDialog(IDOK); CHelloDlg cmd(this); cmd.DoModal(); } after running it . keep pressing the "ok" button continously, the dialog box crashes or ends after 50 times..

          J Offline
          J Offline
          Johan Rosengren
          wrote on last edited by
          #4

          Are you trying to do some silly version of the obnoxious JavaScript-script popping up a messagebox forever ? Anyway, your problem might not so much be the number of times you display a dialog, but rather the amount of dialogs displayed (and parented) at the same time. But the idea of popping up a new dialog - of the same kind - in response to a press on the OK-button - is in the best case silly, in the worst downright malicious. As it is so easy to break out of the loop, by pressing Ctrl+Alt+Del, I'll suggest what you should do anyway: 1. Remove the code in the OnOK-handler, except for the call to the base class implementation. 2. Change the code originally creating the dialog to:

          while( true ) {
          CHelloDlg cmd;
          cmd.DoModal();
          }

          3. Get a new hobby.

          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