VB6.0 屏蔽最大化与最小化 和窗口大小更改。
'设定窗口样式APIPrivateDeclareFunctionSetWindowLongLib"user32"Alias"SetWindowLongA"(ByValhw...
'设定窗口样式API
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'获取窗口样式API
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'(最小化)
Const Ws_MI = &H20000
'(最大化)
Const Ws_MA = &H10000
'(标题栏)
Const Ws_CA = &HC00000
'设置窗口样式API
Const Gw_ST = -&H10 '-4,-8,-12,-16,-20,-21
'
Private Sub Command1_Click()
'按钮消失
Dim lWnd As Long
lWnd = GetWindowLong(Me.hwnd, Gw_ST) '获取
lWnd = lWnd And Not (Ws_MI) '最小化
lWnd = lWnd And Not (Ws_MA) '最大化
SetWindowLong Me.hwnd, Gw_ST, lWnd '设置
End Sub
Private Sub Command2_Click()
'按钮再现
Dim lWnd As Long
lWnd = GetWindowLong(Me.hwnd, Gw_ST) '获取
lWnd = lWnd Or (Ws_MI) '最小化
lWnd = lWnd Or (Ws_MA) '最大化
SetWindowLong Me.hwnd, Gw_ST, lWnd '设置
End Sub
'-------如果添加下边代码关闭按钮没了,如果仅使用上边代码,窗口大小不能固定。
Dim lWnd As Long
lWnd = lWnd Or (Ws_CA)
SetWindowLong Me.hwnd, Gw_ST, lWnd
'如何用这个API屏蔽窗口最大化与最小化并且禁止窗口大小调整! 展开
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
'获取窗口样式API
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
'(最小化)
Const Ws_MI = &H20000
'(最大化)
Const Ws_MA = &H10000
'(标题栏)
Const Ws_CA = &HC00000
'设置窗口样式API
Const Gw_ST = -&H10 '-4,-8,-12,-16,-20,-21
'
Private Sub Command1_Click()
'按钮消失
Dim lWnd As Long
lWnd = GetWindowLong(Me.hwnd, Gw_ST) '获取
lWnd = lWnd And Not (Ws_MI) '最小化
lWnd = lWnd And Not (Ws_MA) '最大化
SetWindowLong Me.hwnd, Gw_ST, lWnd '设置
End Sub
Private Sub Command2_Click()
'按钮再现
Dim lWnd As Long
lWnd = GetWindowLong(Me.hwnd, Gw_ST) '获取
lWnd = lWnd Or (Ws_MI) '最小化
lWnd = lWnd Or (Ws_MA) '最大化
SetWindowLong Me.hwnd, Gw_ST, lWnd '设置
End Sub
'-------如果添加下边代码关闭按钮没了,如果仅使用上边代码,窗口大小不能固定。
Dim lWnd As Long
lWnd = lWnd Or (Ws_CA)
SetWindowLong Me.hwnd, Gw_ST, lWnd
'如何用这个API屏蔽窗口最大化与最小化并且禁止窗口大小调整! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询