Leaked source code of windows server 2003
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.

71 lines
2.2 KiB

  1. #include "folder.h"
  2. #include "utils.h"
  3. #include <mluisupp.h>
  4. ///////////////////////////////////////////////////////////////////////////////
  5. // IContextMenu methods
  6. HRESULT CControlFolder::QueryContextMenu(
  7. HMENU hmenu,
  8. UINT indexMenu,
  9. UINT idCmdFirst,
  10. UINT idCmdLast,
  11. UINT uFlags)
  12. {
  13. USHORT cItems = 0;
  14. DebugMsg(DM_TRACE, TEXT("cf - cm - QueryContextMenu() called."));
  15. if (uFlags == CMF_NORMAL)
  16. {
  17. HMENU hCtrlMenu = LoadMenu(MLGetHinst(), MAKEINTRESOURCE(IDR_CONTROLFOLDER));
  18. if (hmenu)
  19. {
  20. MENUITEMINFO mii;
  21. mii.cbSize = sizeof(mii);
  22. mii.fMask = MIIM_ID;
  23. mii.wID = SFVIDM_MENU_ARRANGE;
  24. SetMenuItemInfo(hCtrlMenu, 0, TRUE, &mii);
  25. cItems = (USHORT)MergeMenuHierarchy(hmenu, hCtrlMenu, idCmdFirst, idCmdLast);
  26. DestroyMenu(hCtrlMenu);
  27. }
  28. }
  29. SetMenuDefaultItem(hmenu, indexMenu, MF_BYPOSITION);
  30. return ResultFromShort(cItems); // number of menu items
  31. }
  32. HRESULT CControlFolder::InvokeCommand(LPCMINVOKECOMMANDINFO pici)
  33. {
  34. // We don't deal with the VERBONLY case
  35. DebugMsg(DM_TRACE, TEXT("cf - cm - InvokeCommand() called."));
  36. Assert((DWORD_PTR)(pici->lpVerb) <= 0xFFFF);
  37. int idCmd;
  38. if ((DWORD_PTR)(pici->lpVerb) > 0xFFFF)
  39. idCmd = -1;
  40. else
  41. idCmd = LOWORD(pici->lpVerb);
  42. return ControlFolderView_Command(pici->hwnd, idCmd);
  43. }
  44. HRESULT CControlFolder::GetCommandString(
  45. UINT_PTR idCmd,
  46. UINT uFlags,
  47. UINT *pwReserved,
  48. LPTSTR pszName,
  49. UINT cchMax)
  50. {
  51. HRESULT hres = E_FAIL;
  52. DebugMsg(DM_TRACE, TEXT("cf - cm - GetCommandString() called."));
  53. if (uFlags == GCS_HELPTEXT)
  54. {
  55. MLLoadString((UINT) (idCmd + IDS_HELP_SORTBYNAME), pszName, cchMax);
  56. hres = S_OK;
  57. }
  58. return hres;
  59. }