程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> Visual Basic語言 >> VB綜合教程 >> 禁止使用 Alt+F4 關閉窗口

禁止使用 Alt+F4 關閉窗口

編輯:VB綜合教程

  聲明:

  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: [email protected]
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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved