Se que el tema es antiguo pero lo retomo porque en un nuevo proyecto necesito quitar el MAX del MDI, no use en su momento este codigo porque use un truco que hacia poner el form MDI mas arriba de la pantalla y no dejo ver la barra, pero para este proyecto no puedo hacer eso, asi que hice esto
Declaracion en el MDIFORM
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
y esto se coloca en el evento Load
Dim L As Long
L = GetWindowLong(Me.hwnd, GWL_STYLE)
L = L And Not (WS_MINIMIZEBOX)
L = L And Not (WS_MAXIMIZEBOX)
L = SetWindowLong(Me.hwnd, GWL_STYLE, L)
Pero no funciona, es decir, los botones siguen alli... ¿que puede estar pasando?. Adicionalmente habría que comentar que el usuario tampoco pueda maximizar haciendo doble click sobre la barra.
Gracias
EDICION: Encontre en la web que faltaba poner en la declaracion esto:
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Pero tampoco me funciono, seguire indagando.
EDICION 2 Probe esto tambien y nada.. que raro!!!, en la declaracion:
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
' Funciones para cambiar el estilo
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
Private Const GWL_STYLE = (-16)
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Const MF_BYPOSITION = &H400&
y en el Load:
Dim Aux As Long
Dim hSysMenu As Long, nCnt As Long
'Elimina los botones
Aux = GetWindowLong(me.hwnd, GWL_STYLE)
SetWindowLong frmBASE.hwnd, GWL_STYLE, aux Xor (WS_MAXIMIZEBOX Or WS_MINIMIZEBOX)
'Elimina los elementos en el menu
hSysMenu = GetSystemMenu(me.hwnd, False)
If hSysMenu Then
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION
RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION
End If
End If
Voy por un trago pq ya me maree.