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. Disable Minimize and Maximize Box

Disable Minimize and Maximize Box

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 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.
  • C Offline
    C Offline
    cb02061
    wrote on last edited by
    #1

    Hi, I want to remove or disable Minimize and Maximize box from SDI Frame... Please anybody help me.... usha

    J 1 Reply Last reply
    0
    • C cb02061

      Hi, I want to remove or disable Minimize and Maximize box from SDI Frame... Please anybody help me.... usha

      J Offline
      J Offline
      Jagdish V Bhimbha
      wrote on last edited by
      #2

      Hi, The CWnd::OnCreate() method is used to create a window and it is usually meant to do this using its default configured features. Therefore, anything you want to display on the frame when the application displays, you can do so when creating the application. Therefore, the frame is typically used to create and display the toolbar(s), dialog bar(s), and status bar. After the frame has been created, if you want to modified something on it, you can do so after it has been created but before it is displayed to the user. To do this, you can use the PreCreateWindow() method of the CWnd class. Its syntax is: virtual void PreCreateWindow(CREATESTRUCT& cs); This method takes a reference to CREATESTRUCT class, modifies and returns it with the new characteristics. For example, you can use this method to remove the Minimize and the Maximize system buttons on the title bar as follows:

      BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
      {
      cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
      return CFrameWnd::PreCreateWindow(cs);
      }

      Hope this help you..! Good Luck..:rose:

      :rose: Jagdish Bhimbha S/W Developer :-O

      C 1 Reply Last reply
      0
      • J Jagdish V Bhimbha

        Hi, The CWnd::OnCreate() method is used to create a window and it is usually meant to do this using its default configured features. Therefore, anything you want to display on the frame when the application displays, you can do so when creating the application. Therefore, the frame is typically used to create and display the toolbar(s), dialog bar(s), and status bar. After the frame has been created, if you want to modified something on it, you can do so after it has been created but before it is displayed to the user. To do this, you can use the PreCreateWindow() method of the CWnd class. Its syntax is: virtual void PreCreateWindow(CREATESTRUCT& cs); This method takes a reference to CREATESTRUCT class, modifies and returns it with the new characteristics. For example, you can use this method to remove the Minimize and the Maximize system buttons on the title bar as follows:

        BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
        {
        cs.style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
        return CFrameWnd::PreCreateWindow(cs);
        }

        Hope this help you..! Good Luck..:rose:

        :rose: Jagdish Bhimbha S/W Developer :-O

        C Offline
        C Offline
        cb02061
        wrote on last edited by
        #3

        Hi Jagdish, The codes did not working..any other solutions??? regards, usha

        J 1 Reply Last reply
        0
        • C cb02061

          Hi Jagdish, The codes did not working..any other solutions??? regards, usha

          J Offline
          J Offline
          Jagdish V Bhimbha
          wrote on last edited by
          #4

          Hi Usha, The solution i gave you must be working, might be there you are doing some mistake in implementing this technique. Do u getting any error message..? Please put this code at approprite place, & with proper arguments. & sorry, i looked for other solution but failed to found..!:confused: Better Luck this Time..:rose::rose:

          :rose: Jagdish Bhimbha S/W Developer :-O

          C 1 Reply Last reply
          0
          • J Jagdish V Bhimbha

            Hi Usha, The solution i gave you must be working, might be there you are doing some mistake in implementing this technique. Do u getting any error message..? Please put this code at approprite place, & with proper arguments. & sorry, i looked for other solution but failed to found..!:confused: Better Luck this Time..:rose::rose:

            :rose: Jagdish Bhimbha S/W Developer :-O

            C Offline
            C Offline
            Christian Kleinheinz
            wrote on last edited by
            #5

            Do edit your CMainFrame::PreCreateWindow function not the one which is inside your view class and the statement will work... BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; cs.style &= ~(WS_MAXIMIZEBOX); return TRUE; }

            dev BGH visit www.mastersoft.at

            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