|
如下代码可以屏蔽acc2003主窗体中的关闭按钮
初学者可以新建一个空白数据库进行测试,在空白数据库里面任意新建一个窗体,进入该窗体代码区(alt+f11),将如下代码复制进去保存,再运行关闭新建的窗体,就可以看到主窗体右上角关闭按钮失效了.
Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert 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 Sub Form_Open(Cancel As Integer)
'取消Access主窗体中的“关闭”按钮
Const MF_BYCOMMAND = &H0&
Const SC_CLOSE = &HF060
Dim hMenu As Long
hMenu = GetSystemMenu(Application.hWndAccessApp, 0)
Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
End Sub |
|