CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2001
    Location
    L.A California
    Posts
    152

    Removing minimize/maximize button of MDIForm's caption bar

    Hi Gurus!
    How can I do in order to remove minimize/maximize/close button of MDIForm's caption bar?

    Could anyone let me know?

    DonYoung,Jeong

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: Removing minimize/maximize button of MDIForm's caption bar

    Code:
    option Explicit
    'this code is in a normal form and disable
    'menu buttons (it does not make them disappear, however)
    private Declare Function GetSystemMenu Lib "user32" (byval hWnd as Long, byval bRevert as Long) as Integer
    private Declare Function DeleteMenu Lib "user32" (byval hMenu as Long, byval iditem as Long, byval wFlags as Long) as Integer
    private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" (byval hMenu as Long, byval nPosition as Long, byval wFlags as Long, byval wIDNewItem as Long, byval lpString as Any) as Long
    
    private Const MF_REMOVE = &H1000&
    private Const SC_CLOSE = &HF060
    private Const MF_BYCOMMAND = &H0
    private Const MF_GRAYED = &H1
    'private Const SC_MOVE = &HF010
    
    Const SC_MAXIMIZE = &HF030
    Const SC_MINIMIZE = &HF020
    
    
    
    
    Private Sub Command1_Click()
       Dim hWnd as Integer, hMenu as Integer, Success as Integer, wFlags as Integer
       Dim nPosition as Integer
       Dim idNewItem as Integer
       Dim s as string
    
       MDIForm1.Show
       hMenu = GetSystemMenu(MDIForm1.hWnd, 0)
    
       Success = DeleteMenu(hMenu, SC_CLOSE, MF_REMOVE Or MF_BYCOMMAND)
       Success = DeleteMenu(hMenu, SC_MINIMIZE, MF_REMOVE Or MF_BYCOMMAND)
       Success = DeleteMenu(hMenu, SC_MAXIMIZE, MF_REMOVE Or MF_BYCOMMAND)
    end sub


    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    Last edited by Cimperiali; October 8th, 2004 at 09:51 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured