I ve tried... i almost did it but in one level submenus... i think that my mind stopped ! can i have any help plz ?....
my code:
...what to say... i am going to be 'a looser' ... :-( no i can't understand the construction of this API !!!Code:Dim MenuCount As Long, ReturnValue As Long Dim HANDLETOSUBMENU As Long, SubMenuCount As Long Dim MII As MENUITEMINFO Dim armenu As Long For armenu = 0 To MenuCount - 1 MII.cbSize = Len(MII) MII.fMask = MIIM_TYPE MII.fType = MFT_STRING MII.dwTypeData = vbNullString MII.cch = Len(MII.dwTypeData) ReturnValue = GetMenuItemInfo(HandleToOtherWindowMenu, armenu, True, MII) MII.dwTypeData = Space(MII.cch + 1) MII.cch = Len(MII.dwTypeData) ReturnValue = GetMenuItemInfo(HandleToOtherWindowMenu, armenu, True, MII) Debug.Print MII.dwTypeData RecursiveMenuWalker armenu Debug.Print Next armenu 'the sub.... Private Sub RecursiveMenuWalker(HandleToMenu As Long) Dim MenuCount As Long, ForLoopCounter As Long Dim HANDLETOSUBMENU As Long Dim MII As MENUITEMINFO Dim ReturnValue As Long Dim SubMenuCollection(100) As Long MII.cbSize = Len(MII) MII.fMask = MIIM_TYPE MII.fType = MFT_STRING HANDLETOSUBMENU = GetSubMenu(HandleToOtherWindowMenu, HandleToMenu) MenuCount = GetMenuItemCount(HANDLETOSUBMENU) If MenuCount <= 0 Then Exit Sub For ForLoopCounter = 0 To MenuCount - 1 'HANDLETOSUBMENU = GetSubMenu(HandleToOtherWindowMenu, ForLoopCounter) 'If HANDLETOSUBMENU > 0 Then ' SubMenuCollection(ForLoopCounter) = HANDLETOSUBMENU 'End If MII.dwTypeData = vbNullString MII.cch = Len(MII.dwTypeData) ReturnValue = GetMenuItemInfo(HANDLETOSUBMENU, ForLoopCounter, True, MII) MII.dwTypeData = Space(MII.cch + 1) MII.cch = Len(MII.dwTypeData) ReturnValue = GetMenuItemInfo(HANDLETOSUBMENU, ForLoopCounter, True, MII) Debug.Print MII.dwTypeData Next ForLoopCounter 'RecursiveMenuWalker HANDLETOSUBMENU 'For ForLoopCounter = 0 To MenuCount - 1 'RecursiveMenuWalker ForLoopCounter 'If SubMenuCollection(ForLoopCounter) > 0 Then RecursiveMenuWalker SubMenuCollection(ForLoopCounter) 'may need to wrap collection with clng() 'Next ForLoopCounter End Sub




Reply With Quote