Sub MDIForm_Load()
Dim lWnd as Long lWnd = GetWindowLong(Me.hWnd, GWL_STYLE) lWnd = lWnd And Not (WS_MINIMIZEBOX) lWnd = lWnd And Not (WS_MAXIMIZEBOX) lWnd = SetWindowLong(Me.hWnd, GWL_STYLE, lWnd) End Sub 'Add this code (which includes the required API declarations) to a BAS module: #If Win32 Then 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 #Else Declare Function SetWindowLong Lib "User" (ByVal hwnd _ As Integer, ByVal nIndex As Integer, ByVal _ dwNewLong As Long) As Long Declare Function GetWindowLong Lib "User" (ByVal hwnd _ As Integer, ByVal nIndex As Integer) As Long #End If Const WS_MINIMIZEBOX = &H20000 Const WS_MAXIMIZEBOX = &H10000 Const GWL_STYLE = (-16) ---------------------------------------------------------------------------------------------------------- Unlike other forms, MDI forms don't have MinButton and MaxButton properties enable or disable the form's Minimize and Maximize buttons. If you add this code to an MDI parent form's Load event, it disables the Minimize and Maximize buttons on the MDI form. If you just want to disable one or the other, comment out the appropriate line, based on which constant you don't need: |