ITPub博客

首页 > 应用开发 > IT综合 > 禁止使用 Alt+F4 关闭窗口 (转)

禁止使用 Alt+F4 关闭窗口 (转)

原创 IT综合 作者:worldblog 时间:2007-12-09 08:54:01 0 删除 编辑
禁止使用 Alt+F4 关闭窗口 (转)[@more@]

 

 

禁止使用 Alt+F4 关闭窗口

声明:

'vb man 2001
'URL: http://goodvbman.yeah.NET
'E-Mail: coolde@21cn.com

Private Declare Function GetSystemMenu Lib "user32" Alias "GetSystemMenu" 
(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 Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As 
Long) As Long
Private Const MF_BYPOSITION = &H400&

使用:

Private Sub Form_Load()
'Vb man 2001
'URL: http://goodvbman.yeah.net
'E-mail: coolde@21cn.com

Dim hwndMenu As Long
Dim c As Long
hwndMenu = GetSystemMenu(Me.hwnd, 0)
c = GetMenuItemCount(hwndMenu)
DeleteMenu hwndMenu, c - 1, MF_BYPOSITION
c = GetMenuItemCount(hwndMenu)
DeleteMenu hwndMenu, c - 1, MF_BYPOSITION
End Sub


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10752043/viewspace-990115/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
  • 博文量
    6241
  • 访问量
    2405734