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
In module:
#If Win32 Then
Public Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal _
nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal _
nIndex As Long) As Long
#Else
Public Declare Function SetWindowLong Lib "User" (ByVal hwnd _
As Integer, ByVal nIndex As Integer, ByVal _
dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "User" (ByVal hwnd _
As Integer, ByVal nIndex As Integer) As Long
#End If
Public Const WS_MINIMIZEBOX = &H20000
Public Const WS_MAXIMIZEBOX = &H10000
Public Const GWL_STYLE = (-16)
You can make it easier. if you just want the button disabled. i guess u want that cuz u want to hide it. just set the form properties --->>>> maxbutton to false. the button is still there but unusable. its easier since u dont have to write any code. you can do the same with the minimze buttons.
People can correct me if I'm wrong and point out any flaws in my answer:
On my MDI forms, if I don't want it to be maximized (because I want the form size to remain constant) I simply change the BorderStyle property on the corresponding form to "1-Fixed Single".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.