Kiln » TortoiseHg » TortoiseHg
Clone URL:  
CShellExtCMenu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _CShellExtCMenu_h_ #define _CShellExtCMenu_h_ #include <vector> #include <string> #include <map> struct MenuDescription { std::string name; std::wstring menuText; std::wstring helpText; std::string iconName; UINT idCmd; }; typedef std::map<std::string, MenuDescription> MenuDescriptionMap; typedef std::map<UINT, MenuDescription> MenuIdCmdMap; class CShellExtCMenu: public IContextMenu3, IShellExtInit { protected: ULONG m_cRef; std::vector<std::string> myFiles; std::string myFolder; MenuDescriptionMap myDescMap; MenuIdCmdMap myMenuIdMap; virtual void RunDialog(const std::string&); void TweakMenuForVista(HMENU menu); void PrintDebugHeader(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj); void InitMenuMaps(const MenuDescription *menuDescs, std::size_t sz); void InsertMenuItemByName( HMENU hMenu, const std::string& name, UINT indexMenu, UINT idCmd, UINT idCmdFirst, const std::wstring& prefix); void AddMenuList(UINT idCmd, const std::string& name); public: explicit CShellExtCMenu(const char dummy); ~CShellExtCMenu(); // IUnknown STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR *ppv); STDMETHODIMP_(ULONG) AddRef(); STDMETHODIMP_(ULONG) Release(); // IContextMenu3 STDMETHODIMP QueryContextMenu( HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); STDMETHODIMP GetCommandString( UINT_PTR idCmd, UINT uFlags, UINT FAR* reserved,LPSTR pszName, UINT cchMax); STDMETHODIMP HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); STDMETHODIMP HandleMenuMsg2( UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT* pResult); // IShellExtInit STDMETHODIMP Initialize( LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID); }; #endif