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.

53 lines
2.2 KiB

  1. // An IContextMenu on an existing IContextMenu, which removes the ';'-separated list of verbs from the resulting menu
  2. HRESULT Create_ContextMenuWithoutVerbs(IUnknown* punk, LPCWSTR pszVerbList, REFIID riid, void **ppv);
  3. // An IContextMenu on an existing IContextMenu, which removes submenus from the resulting menu
  4. HRESULT Create_ContextMenuWithoutPopups(IUnknown* punk, REFIID riid, void **ppv);
  5. // CContextMenuForwarder is designed as a base class that forwards all
  6. // context menu stuff to another IContextMenu implementation. You override
  7. // whatever functions you want to modify. (Like QueryContextMenu - delegate then modify the results)
  8. // For example, CContextMenuWithoutVerbs inherits from this class.
  9. //
  10. class CContextMenuForwarder : IContextMenu3, IObjectWithSite
  11. {
  12. public:
  13. // IUnknown
  14. STDMETHODIMP QueryInterface(REFIID riid, void **ppv);
  15. STDMETHODIMP_(ULONG) AddRef(void) ;
  16. STDMETHODIMP_(ULONG) Release(void);
  17. // IContextMenu3
  18. STDMETHODIMP QueryContextMenu(HMENU hmenu, UINT indexMenu,UINT idCmdFirst,UINT idCmdLast,UINT uFlags) { return _pcm->QueryContextMenu(hmenu,indexMenu,idCmdFirst,idCmdLast,uFlags); }
  19. STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpici) { return _pcm->InvokeCommand(lpici); }
  20. STDMETHODIMP GetCommandString(UINT_PTR idCmd, UINT uType, UINT *pwReserved, LPSTR pszName, UINT cchMax) { return _pcm->GetCommandString(idCmd,uType,pwReserved,pszName,cchMax); }
  21. // IContextMenu2
  22. STDMETHODIMP HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) { return _pcm2->HandleMenuMsg(uMsg,wParam,lParam); }
  23. // IContextMenu3
  24. STDMETHODIMP HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *plResult) { return _pcm3->HandleMenuMsg2(uMsg,wParam,lParam,plResult); }
  25. // IObjectWithSite
  26. STDMETHOD(SetSite)(IUnknown *punkSite) { return _pows->SetSite(punkSite); }
  27. STDMETHOD(GetSite)(REFIID riid, void **ppvSite) { return _pows->GetSite(riid,ppvSite); }
  28. protected:
  29. CContextMenuForwarder(IUnknown* punk);
  30. virtual ~CContextMenuForwarder();
  31. private:
  32. LONG _cRef;
  33. protected:
  34. IUnknown* _punk;
  35. IObjectWithSite* _pows;
  36. IContextMenu* _pcm;
  37. IContextMenu2* _pcm2;
  38. IContextMenu3* _pcm3;
  39. } ;