// Traverse any form of MenuItem
// for more than two hours
// Make some modifications, you can implement other features, the information provided by GetMenuItemInfo is enough.
Procedure ExplorerMenuItem (MenuHandle: Thandle);
VAR
Menuindex: integer;
MenuCaptionArray: array [1..255] of char;
Menucaptionstring: String;
ItemInfo: TMenuItemInfo;
Buffer: array [0..20] of char;
Begin
For Menuindex: = 0 to getMenuItemcount (MenuHandle) - 1 Do Begin
// Something Todo. Here We get the caption
Getmenustring (MenuHandle, MenuIndex, @MenuCaptionArray, 255, MF_BYPOSITION);
MenuCaptionstring: = MenuCaptionArray;
SETLENGTH (MenuCaptionstring, Strlen (pchar (menucaptionstring));
ShowMessage ('Menu Caption:' MenuCaptionstring);
// Get Caption Ends Here.
Iteminfo.cbsize: = sizeof (tMenuiteminfo);
Iteminfo.fmask: = miim_submenu;
Iteminfo.dwtypedata: = buffer;
Iteminfo.cch: = Sizeof (buffer);
GetMenuiteminfo (MenuHandle, MenuIndex, True, ItemInfo);
// Submenu, Calls Itself
IF iteminfo.hsubmenu <> 0 THEN Begin
ExplorerMenuitem (iteminfo.hsubmenu);
END;
END;
END;
--LW549 column