VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 编程开发 > vb >
  • vb中禁用关闭按钮

vb中禁用关闭按钮
Option Explicit

Private Declare Function GetSystemMenu Lib "USER32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "USER32" (ByVal hMenu As Long) As Long
Private Declare Function RemoveMenu Lib "USER32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "USER32" (ByVal hwnd As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
 
Private Sub DisableX()
         Dim hMenu, nCount, LO     As Long
         hMenu = GetSystemMenu(Me.hwnd, 0)
         nCount = GetMenuItemCount(hMenu)
         LO = RemoveMenu(hMenu, nCount - 1, MF_REMOVE Or MF_BYPOSITION)
         LO = RemoveMenu(hMenu, nCount - 2, MF_REMOVE Or MF_BYPOSITION)
End Sub
 
Private Sub Form_Load()
    Call DisableX
End Sub

出处:https://www.cnblogs.com/topboy168/archive/2006/06/23/433681.html
 


相关教程