随着手机里面功能越来越丰富,让我们使用起来越来越方便了,给我们的生活带来了极大的便利。怎样使用V幞洼踉残BA去除与复位窗体的关闭按钮?
工具/原料
手机
方法/步骤
1、首先在开发工具中打开VBA编辑器
2、在单元格区域当中输入一些内容作为例子
3、在VBA编辑器中插入模块
4、在模块当中输入如下代码,然后运行PrivateDeclareFunction掂迎豢畦FindWindowLib"use32&quo墉掠载牿t;Alias"FindWindowA"(ByVallpClassNameAsString,ByVallpWindowNameAsString)AsLongPrivateDeclareFunctionGetWindowLongLib"use32"Alias"GetWindowLongA"(ByValHwndAsLong,ByValnIndexAsLong)AsLongPrivateDeclareFunctionSetWindowLongLib"use32"Alias"SetWindowLongA"(ByValHwndAsLong,ByValnIndexAsLong,_ByValdwNewLongAsLong)AsLongPrivateDeclareFunctionDrawMenuBarLib"use32"(ByValHwndAsLong)AsLongPrivateConstGWL_STYLE=(-16)'窗口样式PrivateConstWS_SYSMENU=&H80000'系统菜单PrivateHwndAsLongPrivateSubUserForm_Click()'单击窗体时恢复按钮DimIstypeAsLongIstype=GetWindowLong(Hwnd,GWL_STYLE)Istype=IstypeOrWS_SYSMENUSetWindowLongHwnd,GWL_STYLE,IstypeDrawMenuBarHwndEndSubPrivateSubUserForm_Initialize()'窗体初始化时去除关闭按钮DimIstypeAsLongHwnd=FindWindow("ThunderDFrame",Me.Caption)Istype=GetWindowLong(Hwnd,GWL_STYLE)Istype=IstypeAndNotWS_SYSMENUSetWindowLongHwnd,GWL_STYLE,IstypeDrawMenuBarHwndEndSub
5、用快捷键F5运行窗体,窗体右上角的关闭按钮已隐藏,如图