I know the code to create a popupmenu and fill it with items. Here is the code:
This will produce an menu item for popupmenu. But I tried to change the ftype, fmask value to create submenu or submenu array within popupmenu without success.Code:Public Declare Function CreatePopupMenu Lib "user32.dll" () As Long
Public 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
Public 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
Dim hPopupMenu As Long
Dim mii As MENUITEMINFO
Dim retval As Long
'inside an event procedure
hPopupMenu = CreatePopupMenu()
With mii
.cbSize = Len(mii)
.fMask = MIIM_STATE Or MIIM_ID Or MIIM_TYPE
.fType = MFT_STRING
.fState = MFS_ENABLED Or MFS_DEFAULT
.wID = ID_ABOUT
.dwTypeData = "&About This Example..."
.cch = Len(.dwTypeData)
End With
retval = InsertMenuItem(hPopupMenu, 0, 1, mii)
Anyone could help me?
