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. How do we hide Modal Dialog Boxes?

How do we hide Modal Dialog Boxes?

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
20 Posts 7 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.
  • W waxie

    The dialog was created with a resource so i have no choice but to display it as modal. Sorry I'm still a novice mfc programmer. I will be the one who will close the modal dialog box and not the user. Say, I have a modal dialog box with a progress bar, and another modal dialog box which runs an update. How do i hide the one which does the update? waxie

    T Offline
    T Offline
    toxcct
    wrote on last edited by
    #6

    modal has nothing do deal with resources... you have a CDialog inherited class, which you associates with a dialog resource... then, when you create you dialogbox, you can call either .DoModal() on it (to make it modal), or .Create() for a modeless dialog. if this code wasn't written directly but you but but the wizard, then go to where the dialog is created and where domodal() is called, and change it...


    TOXCCT >>> GEII power
    [toxcct][VisualCalc 2.20][VCalc 3.0 soon...] -- modified at 5:52 Wednesday 18th January, 2006

    1 Reply Last reply
    0
    • W waxie

      :(( I have a modal dialog box A and when it runs, it stays on top. Is there a way to hide the dialog box or set dialog box A at the back of another modal dialog box? I'm using MFC. I'm kinda desperate for solutions. waxie -- modified at 5:30 Wednesday 18th January, 2006

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #7

      Probably you should look at the option of creating modeless dialog box


      -Prakash

      1 Reply Last reply
      0
      • W waxie

        :(( I have a modal dialog box A and when it runs, it stays on top. Is there a way to hide the dialog box or set dialog box A at the back of another modal dialog box? I'm using MFC. I'm kinda desperate for solutions. waxie -- modified at 5:30 Wednesday 18th January, 2006

        V Offline
        V Offline
        vallikumar
        wrote on last edited by
        #8

        Only chance for you is Modaless dialog. instead of calling DoModal() call Create() example MyClass *obj; obj = new MyClass(); obj->Create(IDD_DIALOG1,this); obj->ShowWindow(SW_SHOW);

        1 Reply Last reply
        0
        • W waxie

          The dialog was created with a resource so i have no choice but to display it as modal. Sorry I'm still a novice mfc programmer. I will be the one who will close the modal dialog box and not the user. Say, I have a modal dialog box with a progress bar, and another modal dialog box which runs an update. How do i hide the one which does the update? waxie

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #9

          Wow, I think your are mixing everything :~ Ok, first, using a modeless dialog box is still done with a ressource. In fact the only thing that changes is that it lets the user work with the rest of your program. Let's take an example: CMyModalDlg Dlg; Dlg.DoModal(); MessageBox("Test message"); If you run this code, you will see that the "Test message" (message box) will only be displayed when you close your modal dialog. It means that your program 'stops' at this line to let the message box receive the inputs from the user. Once the dialog is closed, the DoModal function is exited and your program continues. But this also means that your program main loop is not processed thus you cannot work with the rest of your application (I think you already discovered that). Now, if instead of using a dialog box, you use a modeless one, you won't call the DoModal function (but rather simply ShowWindow) and thus, your program will continue and show immediatley the message box. This means also that you will still be able to 'work' with the rest of your program (click on buttons,...). I suggest you to search for modeless articles on this website to see how to use them. In your example, you won't be able to have two moal dialogs (because of what I explained below). Or, the only way to do it is to open one 'inside the code' of the first one. But, then the first one won't be refreshed and processed. I suggest that you buy yourself a book about the MFC because you are lacking some important concepts there. And it is impossible to explain in detail through a forum. Hope this helps

          W 1 Reply Last reply
          0
          • T toxcct

            CWnd class provides a ShowWindow() function which you could pass SW_HIDE/SW_SHOW parameters...


            TOXCCT >>> GEII power
            [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #10

            toxcct wrote:

            CWnd class provides a ShowWindow() function which you could pass SW_HIDE/SW_SHOW parameters...

            In Case of Modal Dialog, same will not work!, see my reply to actual poster!

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta VC Forum Q&A :- I/ IV

            1 Reply Last reply
            0
            • W waxie

              :(( I have a modal dialog box A and when it runs, it stays on top. Is there a way to hide the dialog box or set dialog box A at the back of another modal dialog box? I'm using MFC. I'm kinda desperate for solutions. waxie -- modified at 5:30 Wednesday 18th January, 2006

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #11

              waxie wrote:

              Is there a way to hide the dialog box

              http://www.voidnish.com/articles/ShowArticle.aspx?code=dlgboxtricks[^]

              waxie wrote:

              r set dialog box A at the back of another modal dialog box?

              Use SetWindowPos Api in the OnInitDialog Virtual Function of your Dialog and Instead of returning TRUE from same function return FALSE

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV

              1 Reply Last reply
              0
              • W waxie

                :(( I have a modal dialog box A and when it runs, it stays on top. Is there a way to hide the dialog box or set dialog box A at the back of another modal dialog box? I'm using MFC. I'm kinda desperate for solutions. waxie -- modified at 5:30 Wednesday 18th January, 2006

                O Offline
                O Offline
                Owner drawn
                wrote on last edited by
                #12

                This will help you... http://www.codeproject.com/dialog/dlgboxtricks.asp[^]

                Jesus Loves:rose:

                --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                T 1 Reply Last reply
                0
                • C Cedric Moonen

                  Wow, I think your are mixing everything :~ Ok, first, using a modeless dialog box is still done with a ressource. In fact the only thing that changes is that it lets the user work with the rest of your program. Let's take an example: CMyModalDlg Dlg; Dlg.DoModal(); MessageBox("Test message"); If you run this code, you will see that the "Test message" (message box) will only be displayed when you close your modal dialog. It means that your program 'stops' at this line to let the message box receive the inputs from the user. Once the dialog is closed, the DoModal function is exited and your program continues. But this also means that your program main loop is not processed thus you cannot work with the rest of your application (I think you already discovered that). Now, if instead of using a dialog box, you use a modeless one, you won't call the DoModal function (but rather simply ShowWindow) and thus, your program will continue and show immediatley the message box. This means also that you will still be able to 'work' with the rest of your program (click on buttons,...). I suggest you to search for modeless articles on this website to see how to use them. In your example, you won't be able to have two moal dialogs (because of what I explained below). Or, the only way to do it is to open one 'inside the code' of the first one. But, then the first one won't be refreshed and processed. I suggest that you buy yourself a book about the MFC because you are lacking some important concepts there. And it is impossible to explain in detail through a forum. Hope this helps

                  W Offline
                  W Offline
                  waxie
                  wrote on last edited by
                  #13

                  Thank you very much for your reply Cedric! :) I sorta crashed myself into MFC. I had to do many things immediately, and learn in the process. Yeah, I admit I have a lousy mfc foundation and sorta did not have a good mfc first impression (I was a java kid). I am sort of in an experimenting stage right now. Good thing there are many of you experts here who can share your thoughts. Thanks! Waxie

                  C 1 Reply Last reply
                  0
                  • O Owner drawn

                    This will help you... http://www.codeproject.com/dialog/dlgboxtricks.asp[^]

                    Jesus Loves:rose:

                    --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                    T Offline
                    T Offline
                    ThatsAlok
                    wrote on last edited by
                    #14

                    Owner drawn wrote:

                    This will help you...

                    Hai, i win the race this time :)

                    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                    cheers, Alok Gupta VC Forum Q&A :- I/ IV

                    O 1 Reply Last reply
                    0
                    • T ThatsAlok

                      Owner drawn wrote:

                      This will help you...

                      Hai, i win the race this time :)

                      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                      cheers, Alok Gupta VC Forum Q&A :- I/ IV

                      O Offline
                      O Offline
                      Owner drawn
                      wrote on last edited by
                      #15

                      Yeah you're right. I didn't see your post as the page was not refreshed. I only saw it afterwards. Dang!:sigh:

                      Jesus Loves:rose:

                      --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                      T 1 Reply Last reply
                      0
                      • O Owner drawn

                        Yeah you're right. I didn't see your post as the page was not refreshed. I only saw it afterwards. Dang!:sigh:

                        Jesus Loves:rose:

                        --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                        T Offline
                        T Offline
                        ThatsAlok
                        wrote on last edited by
                        #16

                        Owner drawn wrote:

                        I didn't see your post as the page was not refreshed. I only saw it afterwards.

                        Better Luck next time... Welcome to Fastest Finger Fast Competition :)

                        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                        cheers, Alok Gupta VC Forum Q&A :- I/ IV

                        O T 2 Replies Last reply
                        0
                        • T ThatsAlok

                          Owner drawn wrote:

                          I didn't see your post as the page was not refreshed. I only saw it afterwards.

                          Better Luck next time... Welcome to Fastest Finger Fast Competition :)

                          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                          cheers, Alok Gupta VC Forum Q&A :- I/ IV

                          O Offline
                          O Offline
                          Owner drawn
                          wrote on last edited by
                          #17

                          Sure buddy! Wait and watch :laugh:

                          Jesus Loves:rose:

                          --Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:

                          1 Reply Last reply
                          0
                          • W waxie

                            Thank you very much for your reply Cedric! :) I sorta crashed myself into MFC. I had to do many things immediately, and learn in the process. Yeah, I admit I have a lousy mfc foundation and sorta did not have a good mfc first impression (I was a java kid). I am sort of in an experimenting stage right now. Good thing there are many of you experts here who can share your thoughts. Thanks! Waxie

                            C Offline
                            C Offline
                            Cedric Moonen
                            wrote on last edited by
                            #18

                            You're welcome ;)

                            1 Reply Last reply
                            0
                            • T ThatsAlok

                              Owner drawn wrote:

                              I didn't see your post as the page was not refreshed. I only saw it afterwards.

                              Better Luck next time... Welcome to Fastest Finger Fast Competition :)

                              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                              cheers, Alok Gupta VC Forum Q&A :- I/ IV

                              T Offline
                              T Offline
                              toxcct
                              wrote on last edited by
                              #19

                              ThatsAlok wrote:

                              Welcome to Fastest Finger Fast Competition

                              :sigh: i was still running the Fastest Nose Contest... :((


                              TOXCCT >>> GEII power
                              [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

                              T 1 Reply Last reply
                              0
                              • T toxcct

                                ThatsAlok wrote:

                                Welcome to Fastest Finger Fast Competition

                                :sigh: i was still running the Fastest Nose Contest... :((


                                TOXCCT >>> GEII power
                                [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]

                                T Offline
                                T Offline
                                ThatsAlok
                                wrote on last edited by
                                #20

                                toxcct wrote:

                                Fastest Nose Contest

                                Opps, i forget the name of contest :)

                                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                                cheers, Alok Gupta VC Forum Q&A :- I/ IV

                                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