如何使vb中MDI主窗口的最大化、关闭按钮无效
1个回答
展开全部
Const GWL_STYLE = (-16)
'窗口关闭按钮
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 Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const MF_BYCOMMAND = &H0&
Const MF_BYPOSITION = &H400&
Const SC_CLOSE = &HF060&
Const WM_CLOSE = &H10
Private hMenu As Long
Private Sub MDIForm_Load()
Dim lWnd As Long
Me.WindowState = 2 '窗口状态是最大化
lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
lWnd = lWnd And Not (WS_MAXIMIZEBOX) '样式里去掉最大化按纽
lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
'窗口关闭按钮
'窗口关闭按钮
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 Declare Function SendMessage Lib "USER32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const MF_BYCOMMAND = &H0&
Const MF_BYPOSITION = &H400&
Const SC_CLOSE = &HF060&
Const WM_CLOSE = &H10
Private hMenu As Long
Private Sub MDIForm_Load()
Dim lWnd As Long
Me.WindowState = 2 '窗口状态是最大化
lWnd = GetWindowLong(Me.hwnd, GWL_STYLE)
lWnd = lWnd And Not (WS_MAXIMIZEBOX) '样式里去掉最大化按纽
lWnd = SetWindowLong(Me.hwnd, GWL_STYLE, lWnd)
'窗口关闭按钮
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询