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.

96 lines
2.4 KiB

  1. // $$ClassType$$CM.cpp : Implementation of C$$ClassType$$CM
  2. #include "stdafx.h"
  3. #include "$$root$$.h"
  4. #include "$$ClassType$$CM.h"
  5. #define ResultFromShort(i) MAKE_HRESULT(SEVERITY_SUCCESS, 0, (USHORT)(i))
  6. #define IDI_EXECUTEITEM 0
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CContents
  9. HRESULT C$$ClassType$$CM::Initialize ( LPCITEMIDLIST pidlFolder,
  10. LPDATAOBJECT lpdobj,
  11. HKEY hkeyProgID)
  12. {
  13. // TODO: Extract items from the dataobject and Folder.
  14. return NOERROR;
  15. }
  16. HRESULT C$$ClassType$$CM::QueryContextMenu(HMENU hmenu,
  17. UINT indexMenu,
  18. UINT idCmdFirst,
  19. UINT idCmdLast,
  20. UINT uFlags)
  21. {
  22. MENUITEMINFO mfi;
  23. UINT idCmd = idCmdFirst;
  24. if (idCmdFirst + IDI_EXECUTEITEM < idCmdLast)
  25. {
  26. // TODO: Chance this to match your item
  27. mfi.cbSize = sizeof(MENUITEMINFO);
  28. mfi.fMask = MIIM_ID|MIIM_TYPE;
  29. mfi.wID = idCmdFirst + IDI_EXECUTEITEM;
  30. mfi.fType = MFT_STRING;
  31. mfi.dwTypeData = (LPTSTR)TEXT("Example Item");
  32. idCmd++;
  33. }
  34. // TODO: Add more items here
  35. if (!InsertMenuItem(hmenu, indexMenu, TRUE, &mfi))
  36. idCmd--; // We weren't able to insert an item
  37. return ResultFromShort(idCmd - idCmdFirst);
  38. }
  39. HRESULT C$$ClassType$$CM::InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
  40. {
  41. if (LOWORD(lpici->lpVerb) == IDI_EXECUTEITEM)
  42. {
  43. MessageBox(lpici->hwnd, "You Selected the example item", "C$$ClassType$$CM", MB_OK);
  44. }
  45. return NOERROR;
  46. }
  47. HRESULT C$$ClassType$$CM::GetCommandString(UINT idCmd,
  48. UINT uType,
  49. UINT * pwReserved,
  50. LPSTR pszName,
  51. UINT cchMax)
  52. {
  53. return E_NOTIMPL;
  54. }
  55. HRESULT C$$ClassType$$CM::HandleMenuMsg2(UINT uMsg,
  56. WPARAM wParam,
  57. LPARAM lParam,
  58. LRESULT* plResult)
  59. {
  60. LRESULT lres = 0;
  61. switch (uMsg)
  62. {
  63. case WM_INITMENUPOPUP:
  64. break;
  65. case WM_MEASUREITEM:
  66. break;
  67. case WM_DRAWITEM:
  68. break;
  69. case WM_MENUCHAR:
  70. lres = 0; // Ignore the character, and issue a short beep.
  71. break;
  72. }
  73. if (plResult)
  74. *plResult = lres;
  75. return NOERROR;
  76. }