Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert 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 Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
Private Const SC_CLOSE = &HF060&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(Me.hwnd, 0), SC_CLOSE, MF_REMOVE
End Sub
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
Private Const SC_CLOSE = &HF060&
Private Sub Form_Load()
RemoveMenu GetSystemMenu(Me.hwnd, 0), SC_CLOSE, MF_REMOVE
End Sub
本文介绍了一种使用Visual Basic编程语言禁用窗体关闭按钮的方法。通过调用API函数GetSystemMenu和RemoveMenu,可以移除窗体上的关闭按钮,实现防止用户直接关闭应用程序的目的。
1637

被折叠的 条评论
为什么被折叠?



