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. Dialog Window

Dialog Window

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
13 Posts 4 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.
  • R radhika28

    Hi, How to find wheather a dilaog window is opened or not programatically. Thanks

    H Offline
    H Offline
    hxhl95
    wrote on last edited by
    #2

    I'd try retrieving something from the window, such as DialogName.GetDC(), and then see if the function returns nothing, or something like that, although there should be a better way of checking.

    1 Reply Last reply
    0
    • R radhika28

      Hi, How to find wheather a dilaog window is opened or not programatically. Thanks

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #3

      You can use IsWindow, IsWindowVisible, etc

      - NS -

      R 1 Reply Last reply
      0
      • N Nishad S

        You can use IsWindow, IsWindowVisible, etc

        - NS -

        R Offline
        R Offline
        radhika28
        wrote on last edited by
        #4

        Hi, I have an option in my application tray menu to display a dialog.When i have used the IsWindowVisible also that particular dalog is displaying as many times the option in the tray menu is selected.If the dialog is already opened it should not open again.I have used the following code.But it doesn't work.How can i go further. CDialog dlg; if(dlg.IsWindowVisible()) { dlg.ShowWindow(SW_HIDE); } Thanks

        N 1 Reply Last reply
        0
        • R radhika28

          Hi, I have an option in my application tray menu to display a dialog.When i have used the IsWindowVisible also that particular dalog is displaying as many times the option in the tray menu is selected.If the dialog is already opened it should not open again.I have used the following code.But it doesn't work.How can i go further. CDialog dlg; if(dlg.IsWindowVisible()) { dlg.ShowWindow(SW_HIDE); } Thanks

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #5

          How do you show the dialog? DoModal? Can you show me the code snippet of the menu option handling?

          - NS -

          R 1 Reply Last reply
          0
          • N Nishad S

            How do you show the dialog? DoModal? Can you show me the code snippet of the menu option handling?

            - NS -

            R Offline
            R Offline
            radhika28
            wrote on last edited by
            #6

            void CMainFrame::OnSettings() { // TODO: Add your command handler code here CSettings dlg; if(!(dlg.IsWindowVisible())) { dlg.DoModal(); } } When i right click on my application's tray icon a tray menu will display.My tray menu have one of the option called "Settings".When click on "settings" the settings dialog( class name:CSettings) will display.But my problem is when i click on the settings n times,then n number Settings dilaog is opening.What i required is,if dilaog is already opened it should not open again.How can i do this. Thanks.

            N D 2 Replies Last reply
            0
            • R radhika28

              void CMainFrame::OnSettings() { // TODO: Add your command handler code here CSettings dlg; if(!(dlg.IsWindowVisible())) { dlg.DoModal(); } } When i right click on my application's tray icon a tray menu will display.My tray menu have one of the option called "Settings".When click on "settings" the settings dialog( class name:CSettings) will display.But my problem is when i click on the settings n times,then n number Settings dilaog is opening.What i required is,if dilaog is already opened it should not open again.How can i do this. Thanks.

              N Offline
              N Offline
              Nishad S
              wrote on last edited by
              #7

              The problem is that you are using the DoModal and the dlg is local in OnSettings(). In this case I will suggest a simple solution. 1. Make the CSettings dlg as class member, CSettings m_dlgSettings. 2. Change the code as, void CMainFrame::OnSettings() { if( IsWindow( m_dlgSettings.m_hWnd )) return; m_dlgSettings.DoModal(); } 3. Let me know the result... ;)

              - NS -

              R 1 Reply Last reply
              0
              • N Nishad S

                The problem is that you are using the DoModal and the dlg is local in OnSettings(). In this case I will suggest a simple solution. 1. Make the CSettings dlg as class member, CSettings m_dlgSettings. 2. Change the code as, void CMainFrame::OnSettings() { if( IsWindow( m_dlgSettings.m_hWnd )) return; m_dlgSettings.DoModal(); } 3. Let me know the result... ;)

                - NS -

                R Offline
                R Offline
                radhika28
                wrote on last edited by
                #8

                Thanks for ur reply.But it doesn't work.The dialog is displaying again and again when i click on the settings option in the menu again and again . Thanks.

                N 1 Reply Last reply
                0
                • R radhika28

                  Thanks for ur reply.But it doesn't work.The dialog is displaying again and again when i click on the settings option in the menu again and again . Thanks.

                  N Offline
                  N Offline
                  Nishad S
                  wrote on last edited by
                  #9

                  Oops really? I had tested the code in some sample application and it is working fine. Are you sure that when you select the settings, on the second time, the control is coming to the same MainFrame object's OnSettings? And are you sure that the object is now member of the class? Can you show me the relevant updations that you made?

                  - NS -

                  R 1 Reply Last reply
                  0
                  • N Nishad S

                    Oops really? I had tested the code in some sample application and it is working fine. Are you sure that when you select the settings, on the second time, the control is coming to the same MainFrame object's OnSettings? And are you sure that the object is now member of the class? Can you show me the relevant updations that you made?

                    - NS -

                    R Offline
                    R Offline
                    radhika28
                    wrote on last edited by
                    #10

                    Thanks NS17.The problem was that i have given same ID for the two menu options in two menus.It is working fine. Thanks -- modified at 4:47 Friday 10th August, 2007

                    N 2 Replies Last reply
                    0
                    • R radhika28

                      Thanks NS17.The problem was that i have given same ID for the two menu options in two menus.It is working fine. Thanks -- modified at 4:47 Friday 10th August, 2007

                      N Offline
                      N Offline
                      Nishad S
                      wrote on last edited by
                      #11

                      So you have two Settings dialog objects, rt? Can you make it global, instead of two member objects? If so only one object will be there.

                      - NS -

                      1 Reply Last reply
                      0
                      • R radhika28

                        Thanks NS17.The problem was that i have given same ID for the two menu options in two menus.It is working fine. Thanks -- modified at 4:47 Friday 10th August, 2007

                        N Offline
                        N Offline
                        Nishad S
                        wrote on last edited by
                        #12

                        Welcome... :)

                        - NS -

                        1 Reply Last reply
                        0
                        • R radhika28

                          void CMainFrame::OnSettings() { // TODO: Add your command handler code here CSettings dlg; if(!(dlg.IsWindowVisible())) { dlg.DoModal(); } } When i right click on my application's tray icon a tray menu will display.My tray menu have one of the option called "Settings".When click on "settings" the settings dialog( class name:CSettings) will display.But my problem is when i click on the settings n times,then n number Settings dilaog is opening.What i required is,if dilaog is already opened it should not open again.How can i do this. Thanks.

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #13

                          This is obviously not going to work. When DoModal() is called, it does not return until the dialog has been dismissed. Therefore, OnSettings() will not get called more than once.


                          "A good athlete is the result of a good and worthy opponent." - David Crow

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          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