问下,VB6的MDI窗体启动时设置为最大化,怎样让窗体的还原按钮失效
我的MDI窗体启动时设置的是最大化,我不想让它能够还原大小,即让右上角的还原按钮失效,该怎样写代码,写在哪?望给出详细解答,谢谢...
我的MDI窗体启动时设置的是最大化,我不想让它能够还原大小,即让右上角的还原按钮失效,该怎样写代码,写在哪?望给出详细解答,谢谢
展开
1个回答
2013-10-15
展开全部
进过测试:Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) _
As Long
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Private Sub MDIForm_Load()
Me.WindowState = 2
Dim L As Long
L = GetWindowLong(Me.hwnd, GWL_STYLE)
' L = L And Not (WS_MINIMIZEBOX) '去掉显示最小按钮
L = L And Not (WS_MAXIMIZEBOX)'去掉显示最大窗口按钮
L = SetWindowLong(Me.hwnd, GWL_STYLE, L)
End Sub
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) _
As Long
Const WS_MINIMIZEBOX = &H20000
Const WS_MAXIMIZEBOX = &H10000
Const GWL_STYLE = (-16)
Private Sub MDIForm_Load()
Me.WindowState = 2
Dim L As Long
L = GetWindowLong(Me.hwnd, GWL_STYLE)
' L = L And Not (WS_MINIMIZEBOX) '去掉显示最小按钮
L = L And Not (WS_MAXIMIZEBOX)'去掉显示最大窗口按钮
L = SetWindowLong(Me.hwnd, GWL_STYLE, L)
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询