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
Private Const MF_BYPOSITION = &H400&
Private Const MF_REMOVE = &H1000&
Private Sub Form_Load()
Dim hwndSysMen As Long
Dim nCount As Long
Me.Show
' Handle des Systemmenüs
hwndSysMen = GetSystemMenu(Me.hwnd, False)
If hwndSysMen Then
' Anzahl der Menü-Items
nCount = GetMenuItemCount(hwndSysMen)
If nCount Then
RemoveMenu hwndSysMen, nCount - 1, MF_BYPOSITION Or MF_REMOVE
RemoveMenu hwndSysMen, nCount - 2, MF_BYPOSITION Or MF_REMOVE
DrawMenuBar Me.hwnd
End If
End If
End Sub