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<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 = &amp;H400&amp;<BR>Private Const MF_DISABLED = &amp;H2&amp;


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中无法实现,请指教。

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

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