mdi窗体怎么屏蔽掉最大化按钮啊?拿分娄!!!!!

zhisheng00 2003-05-19 08:51:41
mdi窗体怎么屏蔽掉最大化按钮啊?
请高手指教!
...全文
34 点赞 收藏 16
写回复
16 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
onedream 2003-08-14
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = (-16)
Public Const WS_MAXIMIZEBOX = &H10000
Private Sub MDIForm_Load()
Dim Win_Style As Long
Win_Style = GetWindowLong(hwnd, GWL_STYLE) And Not WS_MAXIMIZEBOX
SetWindowLong hwnd, GWL_STYLE, Win_Style
End Sub
回复
thinkpad99 2003-05-30
ljfrm_MDImain这个要换成你自己的父窗体名啊
回复
zhisheng00 2003-05-30
请各位大哥帮帮忙啊。
那是我的课程设计啊 。
快要交了
要是它不解决就没有成绩了
回复
lfshf 2003-05-26
不稳定!Load一个非子窗体出来后,任务栏上的Icon不见了,且窗体的尺寸也有变化。
回复
lfshf 2003-05-25
我也找了很久!
回复
cy_nwau 2003-05-24
学习
回复
zhisheng00 2003-05-24
'''''''''''''窗体
Private Sub MDIForm_Load()
Dim lWnd As Long
'lWnd = GetWindowLong(ljfrm_MDImain.hWnd, GWL_STYLE)
lWnd = lWnd And Not (WS_MINIMIZEBOX)
lWnd = lWnd And Not (WS_MAXIMIZEBOX)
lWnd = SetWindowLong(MDI.hWnd, GWL_STYLE, lWnd)
'最大化和最小化无效
Dim hSysMenu As Long
Dim nCnt As Long
hSysMenu = GetSystemMenu(MDI.hWnd, False)
If hSysMenu Then
'nCnt = GetMenuItemCount(hSysMenu)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION Or MF_REMOVE
'DrawMenuBar MDI.hWnd
End If
End Sub
回复
zhisheng00 2003-05-24
'''''''''''''''''模块
Option Explicit
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long

Public Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Public Const WS_MINIMIZEBOX = &H20000
Public Const WS_MAXIMIZEBOX = &H10000
Public Const GWL_STYLE = (-16)
Public Declare Function GetMenuItemCount Lib "user32" (ByVal hWnd As Long)
Public Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Public Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long)
回复
zhisheng00 2003-05-24
thinkpad99 大哥,我要的是屏蔽最大化,你的方法我试了。经过好长时间的调试,出现了许多dll 调用错误。
我把我修改的东西贴再下面。
蓝标题没了。
回复
icedot 2003-05-24
学习
回复
tshow 2003-05-21
就用api,它也算是vb的一部分嘛
呵呵,你讨厌用就告诉微软,让他们帮你封装,或者自己封装
回复
qiangsheng 2003-05-19
没劲,我讨厌API,难道VB本身的功能就不能实现吗?
回复
thinkpad99 2003-05-19
用我办法,根据不显示出来的,试试吧
回复
wangdongzjk 2003-05-19
Option Explicit
Private Declare Function GetMenu Lib "user32" (ByVal hWnd 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 Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Const MF_BYPOSITION = &H400&
-------------------------------------
Private Sub MDIForm_Load()
Dim hMenu As Long
hMenu = GetSystemMenu(Me.hWnd, 0)
RemoveMenu hMenu, 4, MF_BYPOSITION
End Sub
虽然最大化按钮仍然在窗体上显示,但是已经不起作用了。
回复
thinkpad99 2003-05-19
'在模块中声明
'********使最大化和最小化按钮消失*****
Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Public Const WS_MINIMIZEBOX = &H20000
Public Const WS_MAXIMIZEBOX = &H10000
Public Const GWL_STYLE = (-16)
在需要屏蔽的窗体from_load中加入
Dim lWnd As Long
'lWnd = GetWindowLong(ljfrm_MDImain.hWnd, GWL_STYLE)
lWnd = lWnd And Not (WS_MINIMIZEBOX)
lWnd = lWnd And Not (WS_MAXIMIZEBOX)
lWnd = SetWindowLong(ljfrm_MDImain.hWnd, GWL_STYLE, lWnd)
'最大化和最小化无效
Dim hSysMenu As Long
Dim nCnt As Long
hSysMenu = GetSystemMenu(ljfrm_MDImain.hWnd, False)
If hSysMenu Then
nCnt = GetMenuItemCount(hSysMenu)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION Or MF_REMOVE
DrawMenuBar ljfrm_MDImain.hWnd
End If
回复
qiangsheng 2003-05-19
好怪的想法,学习。
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7490

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-19 08:51
社区公告
暂无公告