程序代码: | [ 复制代码 ] |
'/程序功能:禁止窗体移动和改变大小
'/原理:通过删除系统菜单完成
'/石陆软件屋 http://www.cnng.net
'/2008/7/4
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, ByVal wFlags As Long) As Long
Private Const SC_SIZE = &HF000
Private Const SC_MOVE = &HF010
Private Const MF_BYCOMMAND = &H0
'/石陆软件屋 http://www.cnng.net
'/2008/7/4
Private Sub Command1_Click()
Dim hwnd As Long
Dim hMenu As Long
Dim Success As Long
hwnd = Form1.hwnd
hMenu = GetSystemMenu(hwnd, 0)
Success = DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND) '/删除改变大小菜单
Success = DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND) '/删除移动菜单
End Sub
'/原理:通过删除系统菜单完成
'/石陆软件屋 http://www.cnng.net
'/2008/7/4
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, ByVal wFlags As Long) As Long
Private Const SC_SIZE = &HF000
Private Const SC_MOVE = &HF010
Private Const MF_BYCOMMAND = &H0
'/石陆软件屋 http://www.cnng.net
'/2008/7/4
Private Sub Command1_Click()
Dim hwnd As Long
Dim hMenu As Long
Dim Success As Long
hwnd = Form1.hwnd
hMenu = GetSystemMenu(hwnd, 0)
Success = DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND) '/删除改变大小菜单
Success = DeleteMenu(hMenu, SC_MOVE, MF_BYCOMMAND) '/删除移动菜单
End Sub
相关链接:vb | 禁止 | 移动 | 改变大小
[本日志由 admin 于 2013-11-01 11:01 PM 编辑]
引用通告地址 (0):
http://www.cnng.net/blog/trackback.asp?tbID=63
http://www.cnng.net/blog/trackback.asp?tbID=63&CP=GBK
http://www.cnng.net/blog/trackback.asp?tbID=63
http://www.cnng.net/blog/trackback.asp?tbID=63&CP=GBK