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.

60 lines
2.4 KiB

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