VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Hide windows maximize button

by Taklikar AH (3 Submissions)
Category: Windows System Services
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 25th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Hide windows maximize button

API Declarations


Public Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hwnd 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 Const MF_BYPOSITION = &H400&
Public Const MF_REMOVE = &H1000&

Rate Hide windows maximize button



'Hide the menu and disable the maximize button


Public Sub HideMenu(Form As Form)
    
    Dim hSysMenu As Long, nCnt As Long
    ' Get handle to our form's system menu
    ' (Restore, Maximize, Move, close etc.)
    hSysMenu = GetSystemMenu(Form.hwnd, False)

    If hSysMenu Then
        ' Get System menu's menu count
        nCnt = GetMenuItemCount(hSysMenu)
        If nCnt Then
            ' Menu count is based on 0 (0, 1, 2, 3...)
            RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
            RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove the seperator
            DrawMenuBar Form.hwnd
        End If
    End If
End Sub


Download this snippet    Add to My Saved Code

Hide windows maximize button Comments

No comments have been posted about Hide windows maximize button. Why not be the first to post a comment about Hide windows maximize button.

Post your comment

Subject:
Message:
0/1000 characters