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 GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Const MF_BYCOMMAND = &H0&
Const MF_REMOVE = &H1000&
Const MF_BYPOSITION = &H400&Private Sub MDIForm_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 - 3, MF_BYPOSITION Or MF_REMOVE 'delete max button
RemoveMenu hSysMenu, 0, MF_BYPOSITION Or MF_REMOVE 'delete recover button
'DrawMenuBar Me.hwnd
' Force caption bar's refresh. Disabling X button
'Me.Caption = "Try to close me!"
End If
End If
LoadNewDoc
End Sub
Private Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long
Const MF_BYCOMMAND = &H0&
Const MF_REMOVE = &H1000&
Const MF_BYPOSITION = &H400&Private Sub MDIForm_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 - 3, MF_BYPOSITION Or MF_REMOVE 'delete max button
RemoveMenu hSysMenu, 0, MF_BYPOSITION Or MF_REMOVE 'delete recover button
'DrawMenuBar Me.hwnd
' Force caption bar's refresh. Disabling X button
'Me.Caption = "Try to close me!"
End If
End If
LoadNewDoc
End Sub
解决方案 »
- 如何取得CPU的利用率
- VB关于vsflexgrid控件,多行问题
- 怎么做出消息显示是英文的?
- 怎么判断游标是否到达了最后一行呢?Mysql
- 请问如何有选择的启动机器上的AutoCAD的不同版本(在线等待)
- 怎么屏蔽word右键菜单中的接受修订这几个菜单?(在word文件经多人编辑后)
- 如何判断软驱内是否有软盘?
- 谁有人事代理系统啊
- sql语句查询问题!谢谢!! 急用!真的!比较难!!!
- 请教TEXTBOX里如何用上下键实现,在当前位置调用前几次的输入?
- 如何指定TEXTBOX只能输入全角文字或只能输入半角文字...急
- 用VB在2000/NT下屏蔽系统键(ctrl+alt+del win alt+tab等)
SetWindowLong hWnd, GWL_STYLE, WS_MINIMIZEBOX OR WS_SYSMENU OR WS_CAPTION