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.

109 lines
2.3 KiB

  1. /*++
  2. Module Name:
  3. IctxMenu.cpp
  4. Abstract:
  5. This module contains the implementation for CDfsSnapinScopeManager.
  6. Contains the methods of Interface IExtendContextMenu
  7. --*/
  8. #include "stdafx.h"
  9. #include "DfsGUI.h"
  10. #include "MmcDispl.h" // For CMmcDisplay
  11. #include "DfsScope.h"
  12. STDMETHODIMP
  13. CDfsSnapinScopeManager::AddMenuItems(
  14. IN LPDATAOBJECT i_lpDataObject,
  15. IN LPCONTEXTMENUCALLBACK i_lpContextMenuCallback,
  16. IN LPLONG i_lpInsertionAllowed
  17. )
  18. /*++
  19. Routine Description:
  20. Calls the appropriate handler to add the context menu.
  21. Arguments:
  22. i_lpDataObject - Pointer to the IDataObject that identifies the node to which
  23. the menu must be added.
  24. i_lpContextMenuCallback - A callback(function pointer) that is used to add the menu items
  25. i_lpInsertionAllowed - Specifies what menus can be added and where they can be added.
  26. Return value:
  27. S_OK, On success
  28. E_INVALIDARG, On incorrect input parameters
  29. HRESULT sent by methods called, if it is not S_OK.
  30. E_UNEXPECTED, on other errors.
  31. --*/
  32. {
  33. RETURN_INVALIDARG_IF_NULL(i_lpDataObject);
  34. RETURN_INVALIDARG_IF_NULL(i_lpContextMenuCallback);
  35. RETURN_INVALIDARG_IF_NULL(i_lpInsertionAllowed);
  36. HRESULT hr = E_UNEXPECTED;
  37. CMmcDisplay* pCMmcDisplayObj = NULL;
  38. hr = GetDisplayObject(i_lpDataObject, &pCMmcDisplayObj);
  39. RETURN_IF_FAILED(hr);
  40. // Use the virtual method AddMenus in the display object
  41. hr = pCMmcDisplayObj->AddMenuItems(i_lpContextMenuCallback, i_lpInsertionAllowed);
  42. RETURN_IF_FAILED(hr);
  43. return S_OK;
  44. }
  45. STDMETHODIMP
  46. CDfsSnapinScopeManager :: Command(
  47. IN LONG i_lCommandID,
  48. IN LPDATAOBJECT i_lpDataObject
  49. )
  50. /*++
  51. Routine Description:
  52. Use to take action on a menu click or menu command.
  53. Arguments:
  54. i_lCommandID - Used to identify which menu was clicked
  55. i_lpDataObject - Pointer to the IDataObject that identifies the node to which
  56. the menu belongs.
  57. --*/
  58. {
  59. RETURN_INVALIDARG_IF_NULL(i_lpDataObject);
  60. HRESULT hr = E_UNEXPECTED;
  61. CMmcDisplay* pCMmcDisplayObj = NULL;
  62. hr = GetDisplayObject(i_lpDataObject, &pCMmcDisplayObj);
  63. RETURN_IF_FAILED(hr);
  64. // Use the virtual method Command in the display object
  65. hr = pCMmcDisplayObj->Command(i_lCommandID);
  66. RETURN_IF_FAILED(hr);
  67. return S_OK;
  68. }