Juan M Afán de Ribera (Happy) '--------------------------------------------------------- ' ' ActivateControlBox ' ActivateCloseBox ' ActivateMaximizeBox ' ActivateMinimizeBox ' ' Código escrito originalmente por Juan M Afán de Ribera. ' Estás autorizado a utilizarlo dentro de una aplicación ' siempre que esta nota de autor permanezca inalterada. ' En el caso de querer publicarlo en una página Web, ' por favor, contactar con el autor en ' ' accessvbafaq@ya.com ' ' Este código se brinda por cortesía de ' Juan M. Afán de Ribera ' 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 Declare Function GetSystemMenu _ Lib "user32" _ (ByVal hWnd As Long, _ ByVal bRevert As Long) As Long Private Declare Function DrawMenuBar _ Lib "user32" _ (ByVal hWnd 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 Const MF_BYCOMMAND = &H0& Private Const SC_CLOSE = &HF060 Private Const WS_SYSMENU = &H80000 Private Const WS_MAXIMIZEBOX = &H10000 Private Const WS_MINIMIZEBOX = &H20000 Private Const GWL_STYLE = (-16) '--------------------------------------------------------- ' ' ActivateControlBox ' ' Activa/desactiva el cuadro de control de la barra de ' título de la ventana principal de Access (junto con el ' icono y el menú completo) ' Function ActivateControlBox(Enable As Boolean) Dim CurStyle As Long Dim hWnd As Long hWnd = Access.hWndAccessApp CurStyle = GetWindowLong(hWnd, GWL_STYLE) If Enable Then If Not (CurStyle And WS_SYSMENU) Then CurStyle = CurStyle Or WS_SYSMENU End If Else If (CurStyle And WS_SYSMENU) = WS_SYSMENU Then CurStyle = CurStyle - WS_SYSMENU End If End If Call SetWindowLong(hWnd, GWL_STYLE, CurStyle) Call DrawMenuBar(hWnd) End Function '--------------------------------------------------------- '--------------------------------------------------------- ' ' ActivateCloseBox ' ' Activa/desactiva el botón cerrar [X] de la barra de ' título de la ventana principal de Access (junto con la ' correspondiente opción en el menú) ' Function ActivateCloseBox(Enable As Boolean) Dim hMenu As Long Dim hWnd As Long hWnd = Access.hWndAccessApp If Enable Then Call GetSystemMenu(hWnd, True) Else hMenu = GetSystemMenu(hWnd, False) If hMenu Then Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND) End If End If Call DrawMenuBar(hWnd) End Function '--------------------------------------------------------- '--------------------------------------------------------- ' ' ActivateMaximizeBox ' ' Activa/desactiva el botón maximizar [] de la barra de ' título de la ventana principal de Access (junto con la ' correspondiente opción en el menú) ' Function ActivateMaximizeBox(Enable As Boolean) Dim CurStyle As Long Dim hWnd As Long hWnd = Access.hWndAccessApp CurStyle = GetWindowLong(hWnd, GWL_STYLE) If Enable Then If Not (CurStyle And WS_MAXIMIZEBOX) Then CurStyle = CurStyle Or WS_MAXIMIZEBOX End If Else If (CurStyle And WS_MAXIMIZEBOX) = WS_MAXIMIZEBOX Then CurStyle = CurStyle - WS_MAXIMIZEBOX End If End If Call SetWindowLong(hWnd, GWL_STYLE, CurStyle) Call DrawMenuBar(hWnd) End Function '--------------------------------------------------------- '--------------------------------------------------------- ' ' ActivateMinimizeBox ' ' Activa/desactiva el botón minimizar [_] de la barra de ' título de la ventana principal de Access (junto con la ' correspondiente opción en el menú) ' Function ActivateMinimizeBox(Enable As Boolean) Dim CurStyle As Long Dim hWnd As Long hWnd = Access.hWndAccessApp CurStyle = GetWindowLong(hWnd, GWL_STYLE) If Enable Then If Not (CurStyle And WS_MINIMIZEBOX) Then CurStyle = CurStyle Or WS_MINIMIZEBOX End If Else If (CurStyle And WS_MINIMIZEBOX) = WS_MINIMIZEBOX Then CurStyle = CurStyle - WS_MINIMIZEBOX End If End If Call SetWindowLong(hWnd, GWL_STYLE, CurStyle) Call DrawMenuBar(hWnd) End Function '---------------------------------------------------------