明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1557|回复: 1

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

[复制链接]
发表于 2004-7-19 08:50:00 | 显示全部楼层 |阅读模式
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中无法实现,请指教。
发表于 2004-7-21 19:19:00 | 显示全部楼层
能实现啊,明经的二次开发这篇文章,我就是用些去掉x按钮的,不过去掉后窗体不能移动了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 02:29 , Processed in 0.170344 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表