Private Sub ChangeSystemMenus() '更改系统菜单的项。 Dim hSysMenu As Long, nCnt As Long ' 得到窗体的系统菜单。 ' (Restore, Maximize, Move, close etc.) hSysMenu = GetSystemMenu(Me.hWnd, False) If hSysMenu Then ' 得到系统菜单的菜单项数目 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 'RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE '倒数第三项,最大化 RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION Or MF_REMOVE '倒数第4项,最小化 DrawMenuBar Me.hWnd End If End If
'Add about menu to system menu 将about加到系统菜单 Dim lhSysMenu As Long lhSysMenu = GetSystemMenu(hWnd, 0&) Dim lRet As Long lRet = AppendMenu(lhSysMenu, MF_SEPARATOR, 0&, vbNullString) lRet = AppendMenu(lhSysMenu, MF_STRING, IDM_ABOUT, "关于(&A)...") DrawMenuBar Me.hWnd
Private Sub ChangeSystemMenus() '更改系统菜单的项。
Dim hSysMenu As Long, nCnt As Long
' 得到窗体的系统菜单。
' (Restore, Maximize, Move, close etc.)
hSysMenu = GetSystemMenu(Me.hWnd, False) If hSysMenu Then
' 得到系统菜单的菜单项数目
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
'RemoveMenu hSysMenu, nCnt - 3, MF_BYPOSITION Or MF_REMOVE '倒数第三项,最大化
RemoveMenu hSysMenu, nCnt - 4, MF_BYPOSITION Or MF_REMOVE '倒数第4项,最小化
DrawMenuBar Me.hWnd
End If
End If
'Add about menu to system menu 将about加到系统菜单
Dim lhSysMenu As Long
lhSysMenu = GetSystemMenu(hWnd, 0&)
Dim lRet As Long
lRet = AppendMenu(lhSysMenu, MF_SEPARATOR, 0&, vbNullString)
lRet = AppendMenu(lhSysMenu, MF_STRING, IDM_ABOUT, "关于(&A)...")
DrawMenuBar Me.hWnd
SetMenuItemBitmaps lhSysMenu, 5, MF_BYPOSITION, ImlTools.ListImages("ProjectNew").Picture.Handle, 0 '给添加的about菜单加图标
#If SubClass Then
ProcOld = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf WindowProc)
#End If
End Sub