Desabilitar Control CERRAR de Access 2000
Publicado por Salomon (152 intervenciones) el 13/01/2006 13:18:16
Me urge saber como puedo desabilitar el control CERRAR de Access, no el del Formulario
Valora esta pregunta


0
' Sección de Declaraciones :
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
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
' Fin Sección de Declaraciones
' Evento al Cargar :
Private Sub Form_Load()
DoCmd.Maximize
EliminaBotonCerrar Me
End Sub
' Evento que desactiva el botón ( X ) que se llama desde Form_Load :
Private Sub EliminaBotonCerrar(Frm As Form)
Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String
WinWnd = Application.hWndAccessApp
If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub
Dim hSysMenu As Long, nCnt As Long
hSysMenu = GetSystemMenu(WinWnd, False)
If hSysMenu Then
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE
DrawMenuBar Frm.hwnd
End If
End If
End Sub