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. How do I disable system menu buttons

How do I disable system menu buttons

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I want to display the minimize box only and not the close or maximize buttons. Is there any way to do this? Alternatively is there any way to add a button to the title bar and use it instead. Thanx...

    J 1 Reply Last reply
    0
    • L Lost User

      I want to display the minimize box only and not the close or maximize buttons. Is there any way to do this? Alternatively is there any way to add a button to the title bar and use it instead. Thanx...

      J Offline
      J Offline
      JerzyPeter
      wrote on last edited by
      #2

      To disabled the maximize button do this in PreCreateWindow() BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style&=~WS_MAXIMIZEBOX; return TRUE; } To disable system menu do this: cs.style&=~WS_SYSMENU; Jerzy

      L 1 Reply Last reply
      0
      • J JerzyPeter

        To disabled the maximize button do this in PreCreateWindow() BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CFrameWnd::PreCreateWindow(cs) ) return FALSE; // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs cs.style&=~WS_MAXIMIZEBOX; return TRUE; } To disable system menu do this: cs.style&=~WS_SYSMENU; Jerzy

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

        This only grays out the MAX box... > cs.style&=~WS_MAXIMIZEBOX; This disables the entire menu... > cs.style&=~WS_SYSMENU; What I need is remove the maximize and close buttons, not just gray them out. I only want the minimize button to appear. But thanx anyway...

        T T 2 Replies Last reply
        0
        • L Lost User

          This only grays out the MAX box... > cs.style&=~WS_MAXIMIZEBOX; This disables the entire menu... > cs.style&=~WS_SYSMENU; What I need is remove the maximize and close buttons, not just gray them out. I only want the minimize button to appear. But thanx anyway...

          T Offline
          T Offline
          The_Server
          wrote on last edited by
          #4

          You can draw it yourself (e.g. winamp) BTW: for some of you that wished for CodeProject irc server I create a channle on DalNet called "#CodeProject"

          L 1 Reply Last reply
          0
          • T The_Server

            You can draw it yourself (e.g. winamp) BTW: for some of you that wished for CodeProject irc server I create a channle on DalNet called "#CodeProject"

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

            Any source code to demonstrate this ? Thanx..

            1 Reply Last reply
            0
            • L Lost User

              This only grays out the MAX box... > cs.style&=~WS_MAXIMIZEBOX; This disables the entire menu... > cs.style&=~WS_SYSMENU; What I need is remove the maximize and close buttons, not just gray them out. I only want the minimize button to appear. But thanx anyway...

              T Offline
              T Offline
              Tim Deveaux
              wrote on last edited by
              #6

              Is it the main app window? How bout:

              HMENU hmenu = GetSystemMenu ( hwnd, FALSE );
              DeleteMenu ( hmenu, SC\_CLOSE, MF\_BYCOMMAND );
              

              later Oops - just realized that you want to get rid of the buttons entirely - this won't do it. You may have to take over WM_NCPAINT handling...

              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