如何使vb中MDI主窗口的最大化、关闭按钮无效

 我来答
10快乐KHH
推荐于2016-09-19 · TA获得超过171个赞
知道答主
回答量:123
采纳率:80%
帮助的人:60.6万
展开全部
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)
'窗口关闭按钮
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式