Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type DRAWITEMSTRUCT
CtlType As Long
CtlID As Long
itemID As Long
itemAction As Long
itemState As Long
hwndItem As Long
hdc As Long
rcItem As RECT
itemData As Long
End Type
Private Declare Function ModifyMenu Lib "user32" Alias "ModifyMenuA" _
(ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, _
ByVal wIDNewItem As Long, ByVal lpString As Any) As Long
Private Declare Function GetMenu Lib "user32" (ByVal Hwnd As Long) As Long
Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long, _
ByVal nPos As Long) As Long
Private Declare Function GetMenuItemRect Lib "user32" (ByVal Hwnd As Long, _
ByVal hMenu As Long, ByVal uItem As Long, lprcItem As RECT) As Long
Private Sub Form_Load()
Dim lngMenu As Long
Dim lngSubMenu As Long
Dim rcItem As RECT
'get menu handle
lngMenu = GetMenu(Me.Hwnd)
'get rectangle for the first item of the menu
Call GetMenuItemRect(Me.Hwnd, lngMenu, 0, rcItem)
'height of first item in pixels
Label1.Caption = rcItem.Bottom - rcItem.Top
Label2.Caption = rcItem.Left
End Sub