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. Problem with DoModal()

Problem with DoModal()

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
12 Posts 5 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.
  • N Offline
    N Offline
    Neha
    wrote on last edited by
    #1

    Hi, I have a dialog based appliaction, Which was working fine. All of a sudden it started crashing at DoModal(). When i call DoModal() it send WM_DESTROY message. Could anyone please tell me what is wrong? Regards Neha

    A A B 3 Replies Last reply
    0
    • N Neha

      Hi, I have a dialog based appliaction, Which was working fine. All of a sudden it started crashing at DoModal(). When i call DoModal() it send WM_DESTROY message. Could anyone please tell me what is wrong? Regards Neha

      A Offline
      A Offline
      Abhishek Srivastava
      wrote on last edited by
      #2

      Please specify in detail , whether it is a Modal or Modeless dialog , and what do u mean by When u DoModal it sends WM_DESTROY message. Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)

      N 1 Reply Last reply
      0
      • A Abhishek Srivastava

        Please specify in detail , whether it is a Modal or Modeless dialog , and what do u mean by When u DoModal it sends WM_DESTROY message. Abhishek Srivastava Software Engg (VC++) India ,Noida Mobile no 9891492921 :)

        N Offline
        N Offline
        Neha
        wrote on last edited by
        #3

        It is a Modal dialog. What i mean is when i call DoModal(), it comes to OnDestroy() member function of the dialog window.

        J 1 Reply Last reply
        0
        • N Neha

          It is a Modal dialog. What i mean is when i call DoModal(), it comes to OnDestroy() member function of the dialog window.

          J Offline
          J Offline
          jmkhael
          wrote on last edited by
          #4

          Press F9 on destroy, press F5 and then open the callstack and check what's happening Papa while (TRUE) Papa.WillLove ( Bebe ) ;

          N 1 Reply Last reply
          0
          • J jmkhael

            Press F9 on destroy, press F5 and then open the callstack and check what's happening Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            N Offline
            N Offline
            Neha
            wrote on last edited by
            #5

            It crashes at: hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, pParentWnd->GetSafeHwnd(), AfxDlgProc); in DLGCORE.CPP hInst,lpDialogTemplate has the proper values. pParentWnd=NULL; AfxDlgProc has some value. After this it will go to OnDestroy() instead of OnInitDialog()

            J 1 Reply Last reply
            0
            • N Neha

              It crashes at: hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate, pParentWnd->GetSafeHwnd(), AfxDlgProc); in DLGCORE.CPP hInst,lpDialogTemplate has the proper values. pParentWnd=NULL; AfxDlgProc has some value. After this it will go to OnDestroy() instead of OnInitDialog()

              J Offline
              J Offline
              jmkhael
              wrote on last edited by
              #6

              Can you call GetLastError and see the error string? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

              1 Reply Last reply
              0
              • N Neha

                Hi, I have a dialog based appliaction, Which was working fine. All of a sudden it started crashing at DoModal(). When i call DoModal() it send WM_DESTROY message. Could anyone please tell me what is wrong? Regards Neha

                A Offline
                A Offline
                Anonymous
                wrote on last edited by
                #7

                Hi, case 1 CDialog oCDialog; if(oCDialog.DoModal()==IDOK) { } case 2 CDialog *pCDialog; pCDialog = new pCDialog;

                N 1 Reply Last reply
                0
                • A Anonymous

                  Hi, case 1 CDialog oCDialog; if(oCDialog.DoModal()==IDOK) { } case 2 CDialog *pCDialog; pCDialog = new pCDialog;

                  N Offline
                  N Offline
                  Neha
                  wrote on last edited by
                  #8

                  I had used case 1.

                  J A 2 Replies Last reply
                  0
                  • N Neha

                    I had used case 1.

                    J Offline
                    J Offline
                    jmkhael
                    wrote on last edited by
                    #9

                    Did u change the resource file just before it started crashing? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                    N 1 Reply Last reply
                    0
                    • J jmkhael

                      Did u change the resource file just before it started crashing? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                      N Offline
                      N Offline
                      Neha
                      wrote on last edited by
                      #10

                      You are right. I had fixed the problem... Thanks ......

                      1 Reply Last reply
                      0
                      • N Neha

                        Hi, I have a dialog based appliaction, Which was working fine. All of a sudden it started crashing at DoModal(). When i call DoModal() it send WM_DESTROY message. Could anyone please tell me what is wrong? Regards Neha

                        B Offline
                        B Offline
                        Bill S
                        wrote on last edited by
                        #11

                        What kind of controls do you have embedded in this dialog? I seem to remember the need to initialize support for RichEdit Controls prior to their use in a dialog. Best Regards, Bill

                        1 Reply Last reply
                        0
                        • N Neha

                          I had used case 1.

                          A Offline
                          A Offline
                          Anonymous
                          wrote on last edited by
                          #12

                          what i meant by enumerting the cases was that if you do not create the dialog box within if condition then the WM_DESTROY will get generated and it will destroy you dialog box. if you don't wanna use if condition to create a dialog box then you will have to allocate memory to the dialog box pointer with new opeator. i hope this solves your prob.

                          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