Office中国论坛/Access中国论坛

标题: 能不能去掉access自身的关闭按钮 [打印本页]

作者: Henry D. Sy    时间: 2007-6-24 00:39
标题: 能不能去掉access自身的关闭按钮
能不能将access自身的关闭按钮去掉。

[attach]25085[/attach]

是access系统的,不是某个窗体或报表的!

作者: tanhong    时间: 2008-11-28 17:12
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_Load()

  Const MF_BYCOMMAND = &H0&
  Const SC_CLOSE = &HF060    ''恢复按钮的ID是:&HF120
  Dim hMenu As Long
  
  hMenu = GetSystemMenu(Application.hWndaccessApp, 0)
  
  Call DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND)
  
End Sub

还有个最简单的办法,不管按钮id,统统关掉

Private Sub closeAll()

  Const MF_BYCOMMAND = &H0&
  Dim hMenu As Long
  
  hMenu = GetSystemMenu(Application.hWndaccessApp, 0)
  
  dim I as long
  for I=-5000 to 0
    DeleteMenu hMenu, I, MF_BYCOMMAND
  next I
  
End Sub
作者: tanhong    时间: 2008-11-28 17:12
试试这段代码看看
作者: Henry D. Sy    时间: 2008-11-28 18:59
虽然早就解决了,但还是非常感谢江兄![:19]




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3