Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
504 B

  1. #include "priv.h"
  2. #pragma hdrstop
  3. int GetMenuPosFromID(HMENU hmenu, UINT id)
  4. {
  5. int iPos = -1;
  6. int cItems = GetMenuItemCount(hmenu);
  7. int i;
  8. for (i=0; i<cItems;i++)
  9. {
  10. MENUITEMINFO mii;
  11. mii.cbSize = SIZEOF(mii);
  12. mii.fMask = MIIM_ID;
  13. mii.wID = 0;
  14. if (GetMenuItemInfo(hmenu, i, TRUE, &mii))
  15. {
  16. if (mii.wID == id)
  17. {
  18. iPos = i;
  19. break;
  20. }
  21. }
  22. }
  23. return iPos;
  24. }