Yes, mister supergenious knows all:
[tt]
Option Explicit
Private Declare Function GetSystemMenu Lib "user32.dll" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function GetMenuItemCount Lib "user32.dll" (ByVal hMenu As Long) As Long
Private Declare Function InsertMenuItem Lib "user32.dll" Alias "InsertMenuItemA" (ByVal hMenu As Long, ByVal uItem As Long, ByVal fByPosition As Long, lpmii As MENUITEMINFO) As Long
Private Const MIIM_ID = &H2
Private Const MIIM_TYPE = &H10
Private Const MFT_STRING = &H0
Private Type MENUITEMINFO
cbSize As Long
fMask As Long
fType As Long
fState As Long
wID As Long
hSubMenu As Long
hbmpChecked As Long
hbmpUnchecked As Long
dwItemData As Long
dwTypeData As String
cch As Long
End Type
Private Sub Form_Load()
Dim hMenu As Long
Dim lpmii As MENUITEMINFO
hMenu = GetSystemMenu(hWnd, False)
With lpmii
.cbSize = Len(lpmii)
.fMask = MIIM_TYPE Or MIIM_ID
.fType = MFT_STRING
.wID = 100 'ID to check when subclassing
.dwTypeData = "&Howdy"
.cch = Len(.dwTypeData)
End With
Call InsertMenuItem(hMenu, GetMenuItemCount(hMenu), 1, lpmii)
End Sub
[/tt]
If you want to find out if the menuitem was pressed, subclass the WM_SYSCOMMAND message and if the wparam matches the .wID parameter of the MENUITEMINFO type, the menuitem was pressed.