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. Disabling Restore button of a window

Disabling Restore button of a window

Scheduled Pinned Locked Moved C / C++ / MFC
help
8 Posts 2 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
    Deepu Antony
    wrote on last edited by
    #1

    Hi I am dyanamically creating a class inherited from CScrollView. The restore button of this view should be disabled so that the user may not be able to click on it. Please help me. Thanks and regards Deepu.

    L 1 Reply Last reply
    0
    • D Deepu Antony

      Hi I am dyanamically creating a class inherited from CScrollView. The restore button of this view should be disabled so that the user may not be able to click on it. Please help me. Thanks and regards Deepu.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You can use the EnableWindow Function[^] to disable input on the button. Best Wishes, -David Delaune

      D 1 Reply Last reply
      0
      • L Lost User

        You can use the EnableWindow Function[^] to disable input on the button. Best Wishes, -David Delaune

        D Offline
        D Offline
        Deepu Antony
        wrote on last edited by
        #3

        I have dynamically created the window.Now I want to disable/remove the Restore button ie (Minimize,Maximize ,Close) of the window title bar. I wish to disable/remove the restore button so that the user cannot resize the window. The window should be in maximized state intially and if user want,he can minimize it ,but window should not be resized. please help me

        L 1 Reply Last reply
        0
        • D Deepu Antony

          I have dynamically created the window.Now I want to disable/remove the Restore button ie (Minimize,Maximize ,Close) of the window title bar. I wish to disable/remove the restore button so that the user cannot resize the window. The window should be in maximized state intially and if user want,he can minimize it ,but window should not be resized. please help me

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi,

          Deepu Antony wrote:

          I have dynamically created the window.Now I want to disable/remove the Restore button

          For making non-sizable MDI window and removing maximize button://In your OnCreate() WM_CREATE handler CWnd *pParent = GetParent(); CMenu* pMenu = pParent->GetSystemMenu(FALSE); if (NULL != pMenu) { pParent->ModifyStyle(WS_CAPTION|WS_MAXIMIZEBOX ,0,0); pParent->ModifyStyle(WS_THICKFRAME, 0, 0); pParent->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED); }
          Best Wishes, -David Delaune

          D 1 Reply Last reply
          0
          • L Lost User

            Hi,

            Deepu Antony wrote:

            I have dynamically created the window.Now I want to disable/remove the Restore button

            For making non-sizable MDI window and removing maximize button://In your OnCreate() WM_CREATE handler CWnd *pParent = GetParent(); CMenu* pMenu = pParent->GetSystemMenu(FALSE); if (NULL != pMenu) { pParent->ModifyStyle(WS_CAPTION|WS_MAXIMIZEBOX ,0,0); pParent->ModifyStyle(WS_THICKFRAME, 0, 0); pParent->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED); }
            Best Wishes, -David Delaune

            D Offline
            D Offline
            Deepu Antony
            wrote on last edited by
            #5

            Thanks for the reply. I have tried it.And aslo i have tried in childframe precreate function in CREATRSTRUCT structure . CREATRSTRUCT cs; cs ~=WS_MAXIMIZEBOX which disables the maximize box. But both the ways gives me the same result.That intially window is maximised and the user can press the restore button. Once the restore button is pressed, the maximize button is disabled.But this is not the actual requirment that the user should not be able to pres the restore button in initial case also. Is there is any method so that initially also restore button should be disabled

            L 1 Reply Last reply
            0
            • D Deepu Antony

              Thanks for the reply. I have tried it.And aslo i have tried in childframe precreate function in CREATRSTRUCT structure . CREATRSTRUCT cs; cs ~=WS_MAXIMIZEBOX which disables the maximize box. But both the ways gives me the same result.That intially window is maximised and the user can press the restore button. Once the restore button is pressed, the maximize button is disabled.But this is not the actual requirment that the user should not be able to pres the restore button in initial case also. Is there is any method so that initially also restore button should be disabled

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Hi, Sorry for the late reply. The code that I showed you is working for me in VS2008 on MDI child windows. If you show me how and where you are attempting to remove the buttons I may be able to help. Best Wishes, -David Delaune

              D 1 Reply Last reply
              0
              • L Lost User

                Hi, Sorry for the late reply. The code that I showed you is working for me in VS2008 on MDI child windows. If you show me how and where you are attempting to remove the buttons I may be able to help. Best Wishes, -David Delaune

                D Offline
                D Offline
                Deepu Antony
                wrote on last edited by
                #7

                Thank you very much David for showing intrest. I tried to do it in MDI child frame window PreCreateWindow by modifying the CREATESTRUCT it was not working. Also i pasted the code which you have posted in View class OnCreate function . both was showing the same result. Initailly the window will be displayed as maximized and restore dowm button will be enabled. But once the user press the restore down button, the window will be resized and then the Maximize button will be disabled. After that the user cannot click on the maximize button. But what i want to do it is to disable\remove the restore down button in the begining itself so that the user may not be able to resize the window. The reason is that i am displaying a graph which should be always displayed in a full window. Is there any solution.

                L 1 Reply Last reply
                0
                • D Deepu Antony

                  Thank you very much David for showing intrest. I tried to do it in MDI child frame window PreCreateWindow by modifying the CREATESTRUCT it was not working. Also i pasted the code which you have posted in View class OnCreate function . both was showing the same result. Initailly the window will be displayed as maximized and restore dowm button will be enabled. But once the user press the restore down button, the window will be resized and then the Maximize button will be disabled. After that the user cannot click on the maximize button. But what i want to do it is to disable\remove the restore down button in the begining itself so that the user may not be able to resize the window. The reason is that i am displaying a graph which should be always displayed in a full window. Is there any solution.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Deepu Antony wrote:

                  Is there any solution.

                  First lets try to get into the same code. If you have Visual Studio 2008 and have installed the samples navigate to the following folder: Microsoft Visual Studio 9.0\Samples\1033\AllVCLanguageSamples\C++\MFC\advanced\mtmdi Open this project and find the Bounce.cpp file. In the OnCreate function add:CWnd *pParent = GetParent(); CMenu* pMenu = pParent->GetSystemMenu(FALSE); if (NULL != pMenu) { pParent->ModifyStyle(WS_CAPTION|WS_MAXIMIZEBOX ,0,0); pParent->ModifyStyle(WS_THICKFRAME, 0, 0); pParent->ModifyStyle(0,WS_CAPTION,SWP_FRAMECHANGED); }
                  And in the PreCreateWindow function add:cs.style &= ~WS_THICKFRAME;
                  This should cause the MDI window to be non-resizable and the Maximize/Restore grayed out. If you have another version of Visual Studio let me know and we can change samples. Best Wishes, -David Delaune

                  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