微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

vb设置窗体不可移动

Option Explicit
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,Optional ByVal wFlags As Long = 0&) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Dim i As Boolean

Function SetwindowMoveAble(ByVal hWnd As Long,Optional ByVal MoveAble As Boolean = True) As Boolean

'function: SetwindowMoveAble
'
params:
'
hWnd: 一个顶级窗口句柄
'
MoveAble: 是否可移动
'
result: 与参数 Moveable 的设置一样,否则即为失败

Dim mhandle As Long
If MoveAble Then _
GetSystemMenu hWnd,
1&: _
DrawMenuBar hWnd _
Else _
mhandle
= GetSystemMenu(hWnd,0&): _
SetwindowMoveAble
= DeleteMenu(mhandle,&HF010&)

End Function

Private Sub Command1_Click()
SetwindowMoveAble hWnd,i
i
= Not i
End Sub

转自:http://topic.csdn.net/u/20091202/13/66015bdf-6b87-4268-8e9d-dccf45f7ae52.html?15976

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐