VB中如何禁止拖动窗口边缘改变大小?
3个回答
黄先生
2024-12-27 广告
2024-12-27 广告
矩阵切换器就是将一路或多路视音频信号分别传输给一个或者多个显示设备,如两台电脑主机要共用一个显示器,矩阵切换器可以将两台电脑主机上的内容renyi切换到同一个或多个显示器上;迈拓维矩矩阵切换器种类齐全,性价比高,支持多种控制方式,为工程商采...
点击进入详情页
本回答由黄先生提供
展开全部
给你个参考代码琢磨琢磨就知道了
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOSIZE = &H1
Sub main()
Dim hwnd As Long
Dim lStyle As Long
hwnd = FindWindow(vbNullString, "计算器")
If hwnd <> 0 Then
'获得窗口样式
lStyle = GetWindowLong(hwnd, GWL_STYLE)
'取消窗口样式中的最大化和最小化按钮
SetWindowLong hwnd, GWL_STYLE, lStyle And Not WS_MAXIMIZEBOX And Not WS_MINIMIZEBOX
'使样式立即生效
SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_SHOWWINDOW
End If
End Sub
Private Sub Command1_Click()
Call main
End Sub
Private Const GWL_STYLE = (-16)
Private Const WS_MINIMIZEBOX = &H20000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
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 FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const SWP_NOMOVE = &H2
Private Const SWP_NOZORDER = &H4
Private Const SWP_SHOWWINDOW = &H40
Private Const SWP_NOSIZE = &H1
Sub main()
Dim hwnd As Long
Dim lStyle As Long
hwnd = FindWindow(vbNullString, "计算器")
If hwnd <> 0 Then
'获得窗口样式
lStyle = GetWindowLong(hwnd, GWL_STYLE)
'取消窗口样式中的最大化和最小化按钮
SetWindowLong hwnd, GWL_STYLE, lStyle And Not WS_MAXIMIZEBOX And Not WS_MINIMIZEBOX
'使样式立即生效
SetWindowPos hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE Or SWP_NOZORDER Or SWP_SHOWWINDOW
End If
End Sub
Private Sub Command1_Click()
Call main
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以设置form的Borderstyle的值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询