Ocultar la Cinta de Opciones y Desactivar Boton Minimizar
Option Compare Database
Option Explicit
Public BtnCerrar As Boolean
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 DrawMenuBar Lib "user32" _
(ByVal hwnd 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 Declare Function _
FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) 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 Declare Function _
ShowWindow Lib "user32" _
(ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function _
FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, _
ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Const SW_HIDE = 0&
Private Const WS_MAXIMIZEBOX = &H10000
Private Const WS_MINIMIZEBOX = &H20000
Private Const GWL_STYLE = (-16)
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
Private Sub Form_Open(Cancel As Integer)
Dim lngVentana As Long, _
lngManejador As Long, _
lngCuenta As Long, _
strTitulo As String, _
CurStyle As Long, _
hwnd As Long
If SysCmd(acSysCmdAccessVer) = "12.0" Then
Me.Properties.Item("RibbonName") = "rbbInicio"
DoCmd.ShowToolbar "Ribbon", acToolbarNo
End If
lngVentana = FindWindow(vbNullString, strTitulo)
DoCmd.OpenForm "Formulario2", acNormal, , , , acHidden
hwnd = Access.hWndAccessApp
CurStyle = GetWindowLong(hwnd, GWL_STYLE)
lngManejador = GetSystemMenu(lngVentana, False)
If (CurStyle And WS_MINIMIZEBOX) = WS_MINIMIZEBOX Then
CurStyle = CurStyle - WS_MINIMIZEBOX
End If
If lngManejador Then
lngCuenta = GetMenuItemCount(lngManejador)
If lngCuenta Then
RemoveMenu lngManejador, lngCuenta - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu lngManejador, lngCuenta - 2, MF_BYPOSITION Or MF_REMOVE
DrawMenuBar Me.hwnd
End If
End If
Call SetWindowLong(hwnd, GWL_STYLE, CurStyle)
Call DrawMenuBar(hwnd)
End Sub