wyj7485 发表于 2004-7-19 08:50:00

如何去掉VBA窗体的X符号?

Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert 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 Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu As Long) As Long
Private Const MF_BYPOSITION = &H400&
Private Const MF_DISABLED = &H2&
Private Sub Form_Load()
Me.Icon = LoadPicture("")
Call DisableX(Me)
End Sub
Private Sub DisableX(Frm As Form)
Dim hMenu As Long, nCount As Long
hMenu = GetSystemMenu(Frm.hwnd, 0)
nCount = GetMenuItemCount(hMenu)
Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)
DrawMenuBar Frm.hwnd
End Sub该程序在VB中可以实现,但在VBA中无法实现,请指教。

petty 发表于 2004-7-21 19:19:00

能实现啊,乐筑天下的二次开发这篇文章,我就是用些去掉x按钮的,不过去掉后窗体不能移动了。
页: [1]
查看完整版本: 如何去掉VBA窗体的X符号?