示例#1
0
 private static void insertMenu(IntPtr menu, uint idCmdFirst, int pos, IntPtr newPopup, CustomMenuStructure item, ref List <IntPtr> imgPtrConstructed)
 {
     ShellAPI.MENUITEMINFO menuItemInfo = generateMenuItemInfo(item, idCmdFirst);
     if (newPopup != IntPtr.Zero)
     {
         menuItemInfo.hSubMenu = newPopup;
     }
     ShellAPI.InsertMenuItem(menu, (uint)pos, true, ref menuItemInfo);
     if (item.Icon != null)
     {
         IntPtr ptrBitmap = item.Icon.GetHbitmap();
         imgPtrConstructed.Add(ptrBitmap);
         ShellAPI.SetMenuItemBitmaps(menu, (uint)pos, (uint)ShellAPI.MFT.BYPOSITION, ptrBitmap, ptrBitmap);
     }
 }