Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide maximize button in MDIForm

Status
Not open for further replies.
saramaia,

I found this example somewhere:

In MDI form:

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)


vladk
 
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.
 
MDI forms do not have a MaxButton property, which will be why the question was asked...
 
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 works on both SDI and MDI forms.

Jim Schuuz
{ F1 = my.friend
}
 
No, that only works on MDI child forms, not on the MDI Form itself
 
ah ha! thanks for pointing out the difference.

Jim Schuuz
{ F1 = my.friend
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top