Hello,
Dose anybody know the API call to disable the Maximize button on a MDI form. I have spent 21/2 hours searching through the MSDS Library and I have absolutely no luck at all.
Thank you in advance,
Roger
Printable View
Hello,
Dose anybody know the API call to disable the Maximize button on a MDI form. I have spent 21/2 hours searching through the MSDS Library and I have absolutely no luck at all.
Thank you in advance,
Roger
You can eliminate the command of "maximize" from the popup menu of your task. You could also do it with the "minimize", "close", etc.
Hope this was what you were looking for, and get it work. It really works, but don't know if I forgot to paste some other declaration, or something.Code:Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Public Const MF_BYPOSITION = &H400&
Public Const MF_REMOVE = &H1000&
Sub NoMaximize()
Dim hSysMenu As Long
Dim nCnt As Long
' Get handle to our form's system menu
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hwnd, False)
If hSysMenu Then
' Get System menu's menu count\
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
' Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE 'Remove the close
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove el separator (--------)
RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE ' Remove the maximize
RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION Or MF_REMOVE ' Remove the minimize
RemoveMenu hSysMenu, nCnt - 5, MF_BYPOSITION Or MF_REMOVE ' Remove the size
RemoveMenu hSysMenu, nCnt - 6, MF_BYPOSITION Or MF_REMOVE ' Remove the move
DrawMenuBar Me.hwnd
End If
End If
end sub
I´ve no idea why, but the RemoveMenu lines should not be comments. Let´s paste it again. This lines should be executed or not, whether you wnat to disable that action or not.
Hello Mc Brain,
Thank you very very much!
I will give it a go.
Thank you again.
Roger