76 _In_opt_ HBITMAP Bitmap,
77 _In_opt_ PVOID Context
106 if (Item->DeleteFunction)
107 Item->DeleteFunction(Item);
112 DeleteObject(Item->Bitmap);
118 for (i = 0; i < Item->Items->Count; i++)
205 _Out_opt_ PULONG FoundIndex
218 for (i = 0; i < Item->Items->Count; i++)
224 if (Flags & PH_EMENU_FIND_LITERAL)
249 if (Id && item->
Id == Id)
263 *FoundParent = foundParent;
265 *FoundIndex = foundIndex;
300 return PhFindItemList(Parent->Items, Item);
325 if (Index > Parent->Items->Count)
326 Index = Parent->Items->Count;
333 Item->Parent = Parent;
355 Parent = Item->Parent;
359 Index = PhFindItemList(Parent->Items, Item);
372 Item = Parent->Items->Items[Index];
393 for (i = 0; i < Parent->Items->Count; i++)
410 menu = PhAllocate(
sizeof(
PH_EMENU));
428 for (i = 0; i < Menu->Items->Count; i++)
482 menuHandle = CreatePopupMenu();
493 memset(&menuInfo, 0,
sizeof(MENUINFO));
494 menuInfo.cbSize =
sizeof(MENUINFO);
495 menuInfo.fMask = MIM_STYLE;
496 menuInfo.dwStyle = MNS_CHECKORBMP;
497 SetMenuInfo(menuHandle, &menuInfo);
518 _In_ HMENU MenuHandle,
526 MENUITEMINFO menuItemInfo;
528 for (i = 0; i < Menu->Items->Count; i++)
532 memset(&menuItemInfo, 0,
sizeof(MENUITEMINFO));
533 menuItemInfo.cbSize =
sizeof(MENUITEMINFO);
537 menuItemInfo.fMask = MIIM_FTYPE | MIIM_STATE;
541 menuItemInfo.fType = MFT_SEPARATOR;
545 menuItemInfo.fType = MFT_STRING;
546 menuItemInfo.fMask |= MIIM_STRING;
547 menuItemInfo.dwTypeData = item->
Text;
561 menuItemInfo.fMask |= MIIM_BITMAP;
562 menuItemInfo.hbmpItem = item->
Bitmap;
574 id = Data->IdToItem->Count;
576 menuItemInfo.fMask |= MIIM_ID;
577 menuItemInfo.wID = id;
584 menuItemInfo.fMask |= MIIM_ID;
585 menuItemInfo.wID = item->
Id;
592 &menuItemInfo.fState,
600 menuItemInfo.fMask |= MIIM_DATA;
601 menuItemInfo.dwItemData = (ULONG_PTR)item;
607 menuItemInfo.fMask |= MIIM_SUBMENU;
611 InsertMenuItem(MenuHandle, MAXINT,
TRUE, &menuItemInfo);
624 _In_ HMENU MenuHandle
630 count = GetMenuItemCount(MenuHandle);
634 for (i = 0; i < count; i++)
636 MENUITEMINFO menuItemInfo;
640 menuItemInfo.cbSize =
sizeof(menuItemInfo);
641 menuItemInfo.fMask = MIIM_FTYPE | MIIM_ID | MIIM_STATE | MIIM_STRING | MIIM_SUBMENU;
642 menuItemInfo.cch =
sizeof(buffer) /
sizeof(WCHAR);
643 menuItemInfo.dwTypeData = buffer;
645 if (!GetMenuItemInfo(MenuHandle, i,
TRUE, &menuItemInfo))
656 if (menuItemInfo.fType & MFT_SEPARATOR)
672 if (menuItemInfo.hSubMenu)
692 _In_ HINSTANCE InstanceHandle,
694 _In_ ULONG SubMenuIndex
700 menu = LoadMenu(InstanceHandle, Resource);
702 if (SubMenuIndex != -1)
703 realMenu = GetSubMenu(menu, SubMenuIndex);
730 _In_ HWND WindowHandle,
744 flags = TPM_RETURNCMD | TPM_NONOTIFY;
749 flags |= TPM_RIGHTBUTTON;
751 flags |= TPM_LEFTBUTTON;
756 flags |= TPM_LEFTALIGN;
758 flags |= TPM_RIGHTALIGN;
760 flags |= TPM_CENTERALIGN;
763 flags |= TPM_TOPALIGN;
765 flags |= TPM_BOTTOMALIGN;
767 flags |= TPM_VCENTERALIGN;
773 result = TrackPopupMenu(
788 DestroyMenu(popupMenu);
794 SendMessage(WindowHandle, WM_COMMAND, MAKEWPARAM(selectedItem->
Id, 0), 0);
820 item->
Flags &= ~Mask;
821 item->
Flags |= Value;
846 for (i = 0; i < Item->Items->Count; i++)
850 item->
Flags &= ~Mask;
851 item->
Flags |= Value;
857 _In_ ULONG ModifyFlags,
858 _In_ ULONG OwnedFlags,
860 _In_opt_ HBITMAP Bitmap
876 DeleteObject(Item->Bitmap);
878 Item->Bitmap = Bitmap;