Results 1 to 3 of 3

Thread: Disable Minimize/Maximize/Exit window buttons

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Fountain Valley, CA
    Posts
    6

    Disable Minimize/Maximize/Exit window buttons

    How do you disable the minimize/maximize/exit buttons in the upper-right corner of a form control? I'd just like to grey them out.

    Thanks in advance,

    spanqy
    Mark Sanchez
    SPEC Services, Inc.
    Fountain Valley, CA USA

  2. #2
    Fanatic Member
    Join Date
    Jan 2001
    Location
    Vietnam
    Posts
    613
    Add the following code to a module:

    Code:
    Option Explicit
    
    Public Const MF_BYPOSITION = &H400&
    Public Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
    Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
    
    Public Sub DisableMinimizeButton(lhWnd As Long)
        Dim hSystemMenu As Long
        hSystemMenu = GetSystemMenu(lhWnd, 0)
        Call RemoveMenu(hSystemMenu, 3, MF_BYPOSITION)
    End Sub
    
    Public Sub DisableMaxButton(lhWnd As Long)
        Dim hSystemMenu As Long
        hSystemMenu = GetSystemMenu(lhWnd, 0)
        Call RemoveMenu(hSystemMenu, 4, MF_BYPOSITION)
        
    End Sub
    
    Public Sub DisableCloseWindow(lhWnd As Long)
        Dim hSystemMenu As Long
        hSystemMenu = GetSystemMenu(lhWnd, 0)
        Call RemoveMenu(hSystemMenu, 6, MF_BYPOSITION)
        Call RemoveMenu(hSystemMenu, 5, MF_BYPOSITION)
    End Sub
    Regards.

  3. #3
    Megatron
    Guest
    The Min and Max buttons can be disabled by setting the MaxButton and MaxButton properties to false.

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