January 1, 2005

WinTask - GetMenuItemInfo

'
' GetMenuItemInfo
'
' Author: Joe Strazzere
'

'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
dim MENUITEMINFO as unsigned
dim ptr as unsigned
MENUITEMINFO=allocate(100)

hwnd=GetWindowHandle(top$(),1)
hmenu=External("user32","GetMenu", hwnd)
'hsubmeu=External("user32","GetSubMenu", hMenu, 1)
ret=External("user32", "GetMenuItemInfoA", hmenu, 0, 1, MENUITEMINFO)
ptr=MENUITEMINFO+12
var=peekinteger(ptr,4)
msgbox(str$(var))