Cita:
|
Empezado por dares_ Si te entiendo, pasa por un detalle nada más y por lo detallista q puedas ser...como comentaba antes pude hacer q al menos no funciene la x q cierra el formulario, el tema ahora es q me gustaria q desapareciera de ahi porque queda desprolijo a mi entender dejarla ahi si no cumple ninguna funcion y tambien la opcion de maximizar q desaparezca...
es decir lo q quiero es q el formulario MDI me quede solamente con la opcion de minimizarlo nada mas...alguien del foro sabe como hacer esto?
o si es posible? ya q en los formularios MDI no existe la opcion de ControlBox...
Diego Ares :smt004 |
Hola amigo:
A ver que te parece este código.
Option Explicit
Private Const WS_MINIMIZEBOX = &H20000
Private Const WS_MAXIMIZEBOX = &H10000
Private Const GWL_STYLE = (-16)
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 Declare Function GetSystemMenu Lib "user32" _
(ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "user32" _
(ByVal hMenu As Long, ByVal nPosition As Long, _
ByVal wFlags As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Sub DesactivarMenu(frm As Form)
Dim hSysmenu As Long
hSysmenu = GetSystemMenu(frm.hwnd, 0)
RemoveMenu hSysmenu, 6, MF_BYPOSITION
RemoveMenu hSysmenu, 5, MF_BYPOSITION
RemoveMenu hSysmenu, 4, MF_BYPOSITION
RemoveMenu hSysmenu, 2, MF_BYPOSITION
RemoveMenu hSysmenu, 1, MF_BYPOSITION
End Sub
Private Sub MDIForm_Load()
Dim lRet As Long
lRet = GetWindowLong(Me.hwnd, GWL_STYLE)
lRet = lRet And Not (WS_MAXIMIZEBOX)
lRet = SetWindowLong(Me.hwnd, GWL_STYLE, lRet)
' Desactiva las opciones del menú del MDI (esq.superior izq)
DesactivarMenu Me
End Sub
Private Sub MDIForm_QueryUnload(Cancel As Integer, UnloadMode As Integer)
' para evitar cerrar el form si se pulsa Alt-F4
' así no se cierra nunca el form
If UnloadMode = 0 Then Cancel = True
End Sub
Private Sub MenuSalir_Click()
End
End Sub
Saludos