Disable application maximize button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • convexcube
    New Member
    • Dec 2007
    • 47

    Disable application maximize button

    Hi everyone,

    Now that I've found a way to disable the ribbon etc. I need to disable the application maximize button. I have looked at this post and implemented it, but it disables the close and minimize buttons as well. Is there a simple command I can use to disable just this button or any way I can adapt the cited post to do just that?

    Kind regards,

    Ken.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Disable MAXIMIZE Button

    Try this code in a Standard Code Module, then Call the Function:
    Code:
    Private Const GWL_STYLE = (-16)
    Private Const WS_MAXIMIZEBOX = &H10000
    
    Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
            (ByVal hwnd As Long, ByVal nIndex As Long, _
            ByVal dwNewLong As Long) As Long
    Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
            (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    Code:
    Function DisableMAXIMIZE() As Long
    Dim hMenu As Long
    Dim lStyle As Long
    Dim Lhwnd As Long
    
    Lhwnd = Access.Application.hWndAccessApp
        
    'Disable MAXIMIZE button
    lStyle = GetWindowLong(Lhwnd, GWL_STYLE)
    lStyle = lStyle And Not WS_MAXIMIZEBOX
    
    Call SetWindowLong(Lhwnd, GWL_STYLE, lStyle)
    End Function

    Comment

    • convexcube
      New Member
      • Dec 2007
      • 47

      #3
      Thanks ADezii, works a treat. Much Appreciated, Ken

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        Originally posted by convexcube
        Thanks ADezii, works a treat. Much Appreciated, Ken
        Glad it worked for you.

        Comment

        Working...