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. can we stop dialog from exiting when i click on red cross button?

can we stop dialog from exiting when i click on red cross button?

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 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
    sayup
    wrote on last edited by
    #1

    hello, I have created a dialog based application.In the menu of parent dialog i am popping up another dialog.When i click on the Cancel button or the Cross red button of my dialog I get exited from complete application.i.e.the OnClose of CDialog gets called.I want only that pop up dialog to be closed and not complete apllication(i.e.the parent dialog on which my dialogis popping is also closed)How can i override the OnClose() and OnCancel()?of my dialog to stop this?

    M S 2 Replies Last reply
    0
    • S sayup

      hello, I have created a dialog based application.In the menu of parent dialog i am popping up another dialog.When i click on the Cancel button or the Cross red button of my dialog I get exited from complete application.i.e.the OnClose of CDialog gets called.I want only that pop up dialog to be closed and not complete apllication(i.e.the parent dialog on which my dialogis popping is also closed)How can i override the OnClose() and OnCancel()?of my dialog to stop this?

      M Offline
      M Offline
      mark novak
      wrote on last edited by
      #2

      In Visual Studio .NET you can add events by selecting the class in the class view and then going to the properties window and clicking on the messages view and then finding the message you want, in your case WM_CLOSE, and selecting On Close. In Visual Studio 6 you can add events by opening up a dialog from the resource view and then right clicking on it and going to Class Wizard or events. Something in that area.

      1 Reply Last reply
      0
      • S sayup

        hello, I have created a dialog based application.In the menu of parent dialog i am popping up another dialog.When i click on the Cancel button or the Cross red button of my dialog I get exited from complete application.i.e.the OnClose of CDialog gets called.I want only that pop up dialog to be closed and not complete apllication(i.e.the parent dialog on which my dialogis popping is also closed)How can i override the OnClose() and OnCancel()?of my dialog to stop this?

        S Offline
        S Offline
        Stlan
        wrote on last edited by
        #3

        You can also disable the Close X button of a CWnd derived-object by calling GetSystemMenu()->EnableMenuItem(SC_CLOSE, MF_DISABLED);

        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