如何禁用窗体右上角的关闭按钮
如何禁用窗体右上角的关闭按钮
[解决办法]
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 Sub Form_Load()
Dim lHndSysMenu As Long
lHndSysMenu = GetSystemMenu(Me.hwnd, 0)
'Remove Close button
Call RemoveMenu(lHndSysMenu, 6, MF_BYPOSITION)
'Remove Seperator bar
Call RemoveMenu(lHndSysMenu, 5, MF_BYPOSITION)
End Sub