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. Closing a dialog box [modified]

Closing a dialog box [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutoriallounge
10 Posts 6 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.
  • D Offline
    D Offline
    Dhiraj kumar Saini
    wrote on last edited by
    #1

    Hello, I am working on an mfc application in which i have a chat dialogbox with smiley button. On click of smiley button i am opeining a new dialogbox with emoticon Now i want to close the dialog with emoticon button when mouse is clicked outside it. Please help me how to do it. Thanks In Advance.

    modified on Monday, November 17, 2008 5:36 AM

    T _ C H D 5 Replies Last reply
    0
    • D Dhiraj kumar Saini

      Hello, I am working on an mfc application in which i have a chat dialogbox with smiley button. On click of smiley button i am opeining a new dialogbox with emoticon Now i want to close the dialog with emoticon button when mouse is clicked outside it. Please help me how to do it. Thanks In Advance.

      modified on Monday, November 17, 2008 5:36 AM

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

      I believe you shouldn't have managed this with a dialog but with an owner drawn menu...

      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      D 1 Reply Last reply
      0
      • D Dhiraj kumar Saini

        Hello, I am working on an mfc application in which i have a chat dialogbox with smiley button. On click of smiley button i am opeining a new dialogbox with emoticon Now i want to close the dialog with emoticon button when mouse is clicked outside it. Please help me how to do it. Thanks In Advance.

        modified on Monday, November 17, 2008 5:36 AM

        _ Offline
        _ Offline
        _AnsHUMAN_
        wrote on last edited by
        #3

        Handle WM_KILLFOCUS. Another way would be to create your window with WS_POPUPWINDOW style.

        Some things seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

        D 1 Reply Last reply
        0
        • _ _AnsHUMAN_

          Handle WM_KILLFOCUS. Another way would be to create your window with WS_POPUPWINDOW style.

          Some things seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          D Offline
          D Offline
          Dhiraj kumar Saini
          wrote on last edited by
          #4

          I have created my window with WS_POPUP. How can I handle WM_KILLFOCUS. Please elaborate it if possible. Thanks

          1 Reply Last reply
          0
          • T toxcct

            I believe you shouldn't have managed this with a dialog but with an owner drawn menu...

            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            D Offline
            D Offline
            Dhiraj kumar Saini
            wrote on last edited by
            #5

            can you help me with some article as i dont know this metho. How to use owner draw menu.

            T 1 Reply Last reply
            0
            • D Dhiraj kumar Saini

              Hello, I am working on an mfc application in which i have a chat dialogbox with smiley button. On click of smiley button i am opeining a new dialogbox with emoticon Now i want to close the dialog with emoticon button when mouse is clicked outside it. Please help me how to do it. Thanks In Advance.

              modified on Monday, November 17, 2008 5:36 AM

              C Offline
              C Offline
              CPallini
              wrote on last edited by
              #6

              If it is a modal dialog box then you have no chance. On the other hand, if it is a modeless dialog, then send it the WM_CLOSE message. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              D 1 Reply Last reply
              0
              • C CPallini

                If it is a modal dialog box then you have no chance. On the other hand, if it is a modeless dialog, then send it the WM_CLOSE message. :)

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                D Offline
                D Offline
                Dhiraj kumar Saini
                wrote on last edited by
                #7

                Yes it is a modal dialog box. I am doing DoModal.

                1 Reply Last reply
                0
                • D Dhiraj kumar Saini

                  Hello, I am working on an mfc application in which i have a chat dialogbox with smiley button. On click of smiley button i am opeining a new dialogbox with emoticon Now i want to close the dialog with emoticon button when mouse is clicked outside it. Please help me how to do it. Thanks In Advance.

                  modified on Monday, November 17, 2008 5:36 AM

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  SendMessage(hwnd,WM_CLOSE,0,0);.

                  1 Reply Last reply
                  0
                  • D Dhiraj kumar Saini

                    can you help me with some article as i dont know this metho. How to use owner draw menu.

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

                    Dhiraj kumar Saini wrote:

                    How to use owner draw menu

                    Menus Knowledge Base[^]...

                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    1 Reply Last reply
                    0
                    • D Dhiraj kumar Saini

                      Hello, I am working on an mfc application in which i have a chat dialogbox with smiley button. On click of smiley button i am opeining a new dialogbox with emoticon Now i want to close the dialog with emoticon button when mouse is clicked outside it. Please help me how to do it. Thanks In Advance.

                      modified on Monday, November 17, 2008 5:36 AM

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

                      Dhiraj kumar Saini wrote:

                      Now i want to close the dialog...

                      If it's a modal dialog, call EndDialog().

                      Dhiraj kumar Saini wrote:

                      ...when mouse is clicked outside it.

                      See here.

                      "Love people and use things, not love things and use people." - Unknown

                      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                      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