如何去掉VBA窗体的X符号?
Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long<BR>Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long<BR>Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long) As Long<BR>Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu As Long) As Long<BR>Private Const MF_BYPOSITION = &H400&<BR>Private Const MF_DISABLED = &H2&Private Sub Form_Load()<BR>Me.Icon = LoadPicture("")<BR>Call DisableX(Me)<BR>End Sub
Private Sub DisableX(Frm As Form)<BR>Dim hMenu As Long, nCount As Long<BR>hMenu = GetSystemMenu(Frm.hwnd, 0)<BR>nCount = GetMenuItemCount(hMenu)<BR>Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)<BR>DrawMenuBar Frm.hwnd<BR>End Sub
该程序在VB中可以实现,但在VBA中无法实现,请指教。 能实现啊,明经的二次开发这篇文章,我就是用些去掉x按钮的,不过去掉后窗体不能移动了。
页:
[1]