关于窗口风格!!!

zhou 2000-08-15 08:55:00
请问,当窗口只有一个关闭按钮时,怎样使该窗口在显示标题条和该按钮的同时又使该按钮呈现灰色的失效状态??!!!!
...全文
185 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wxj_lake 2000-11-21
  • 打赏
  • 举报
回复
controlbox属性设为false除去所有的按钮的话,图标也没有了,还是用API较好。
shines77 2000-11-21
  • 打赏
  • 举报
回复
我现在才发现,wxj_lake是高手啊,高人。
shines77 2000-11-21
  • 打赏
  • 举报
回复
谢谢各位了:)
zhou 2000-11-20
  • 打赏
  • 举报
回复
感谢shines老兄,真不好意思这么久才给你加分,因为我的ie有点小问题,对不起了!!!
对了,老兄,我发现将窗口的controlbox属性设为false即可去除所有的按钮!!
shines77 2000-08-15
  • 打赏
  • 举报
回复
VB的源代码:

Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Const MF_BYPOSITION = &H400&
Const MF_REMOVE = &H1000&
Private Sub Form_Load()
Dim hSysMenu As Long, nCnt As Long
' Get handle to our form's system menu
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hwnd, False)

If hSysMenu Then
' Get System menu's menu count
nCnt = GetMenuItemCount(hSysMenu)
If nCnt Then
' Menu count is based on 0 (0, 1, 2, 3...)
RemoveMenu hSysMenu, nCnt - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hSysMenu, nCnt - 2, MF_BYPOSITION Or MF_REMOVE ' Remove the seperator
DrawMenuBar Me.hwnd
' Force caption bar's refresh. Disabling X button
Me.Caption = "Try to close me!"
End If
End If
End Sub

哈,我厉害吧,给分吧 。
shines77 2000-08-15
  • 打赏
  • 举报
回复
RemoveSystemMenu
就是删除系统菜单 [关闭 Alt+F4]
就OK了,具体的API我去找找,如果不见我回复,请 E-mail:wokss@yeah.net
yk_001 2000-08-15
  • 打赏
  • 举报
回复
使用API函数

7,759

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧