search gave me no luck so can anyone tell me how to remove the max button within an mdi parent? the max button on the top right of the form.
thanks in advance.
Printable View
search gave me no luck so can anyone tell me how to remove the max button within an mdi parent? the max button on the top right of the form.
thanks in advance.
I have just writen this code. Works on WinXP-SP2. Haven't tested on other platform:
VB Code:
'Inside MDIForm Option Explicit Private Declare Function GetSystemMenu Lib "user32" _ (ByVal hWnd As Long, _ ByVal bRevert As Long) As Long Private Declare Function DeleteMenu Lib "user32" _ (ByVal hMenu As Long, _ ByVal nPosition As Long, _ ByVal wFlags As Long) As Long Private Declare Function DrawMenuBar Lib "user32" _ (ByVal hWnd As Long) As Long Private Declare Function GetWindowLong Lib _ "user32" Alias "GetWindowLongA" (ByVal hWnd _ As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib _ "user32" Alias "SetWindowLongA" (ByVal hWnd _ As Long, ByVal nIndex As Long, ByVal dwNewLong _ As Long) As Long Private Const MF_BYCOMMAND = &H0 Private Const SC_MAXIMIZE As Long = &HF030& Private Const GWL_STYLE& = (-16) Private Const WS_MAXIMIZEBOX As Long = &H10000 '================================================================= Private Sub MDIForm_Load() DisableMaxButton End Sub '================================================================= Public Sub DisableMaxButton() 'This sub Removes Maximize button from control box and system menu. Dim hMenu As Long Dim OldStyle As Long 'Remove Max button OldStyle = GetWindowLong(Me.hWnd, GWL_STYLE) SetWindowLong Me.hWnd, GWL_STYLE, OldStyle And (Not WS_MAXIMIZEBOX) 'Remove from system menu hMenu = GetSystemMenu(Me.hWnd, 0&) If hMenu Then Call DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND) Call DrawMenuBar(Me.hWnd) End If End Sub
thanks for the code. will have to test it on other platforms too. and will get back to you.