xref: /reactos/dll/win32/shell32/COpenWithMenu.h (revision 49b2b1da)
1c2c66affSColin Finck /*
2c2c66affSColin Finck  *  Open With  Context Menu extension
3c2c66affSColin Finck  *
4c2c66affSColin Finck  * Copyright 2007 Johannes Anderwald <johannes.anderwald@reactos.org>
5c2c66affSColin Finck  * Copyright 2009 Andrew Hill
6c2c66affSColin Finck  * Copyright 2012 Rafal Harabien
7c2c66affSColin Finck  *
8c2c66affSColin Finck  * This library is free software; you can redistribute it and/or
9c2c66affSColin Finck  * modify it under the terms of the GNU Lesser General Public
10c2c66affSColin Finck  * License as published by the Free Software Foundation; either
11c2c66affSColin Finck  * version 2.1 of the License, or (at your option) any later version.
12c2c66affSColin Finck  *
13c2c66affSColin Finck  * This library is distributed in the hope that it will be useful,
14c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16c2c66affSColin Finck  * Lesser General Public License for more details.
17c2c66affSColin Finck  *
18c2c66affSColin Finck  * You should have received a copy of the GNU Lesser General Public
19c2c66affSColin Finck  * License along with this library; if not, write to the Free Software
20c2c66affSColin Finck  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21c2c66affSColin Finck  */
22c2c66affSColin Finck 
23c2c66affSColin Finck #ifndef _SHE_OCMENU_H_
24c2c66affSColin Finck #define _SHE_OCMENU_H_
25c2c66affSColin Finck 
26c2c66affSColin Finck class COpenWithList;
27c2c66affSColin Finck 
28c2c66affSColin Finck class COpenWithMenu :
29c2c66affSColin Finck     public CComCoClass<COpenWithMenu, &CLSID_OpenWithMenu>,
30c2c66affSColin Finck     public CComObjectRootEx<CComMultiThreadModelNoCS>,
31c2c66affSColin Finck     public IContextMenu2,
32c2c66affSColin Finck     public IShellExtInit
33c2c66affSColin Finck {
34c2c66affSColin Finck     private:
35c2c66affSColin Finck         UINT m_idCmdFirst, m_idCmdLast;
36c2c66affSColin Finck         WCHAR m_wszPath[MAX_PATH];
37c2c66affSColin Finck         HMENU m_hSubMenu;
38c2c66affSColin Finck         COpenWithList *m_pAppList;
39c2c66affSColin Finck 
40c2c66affSColin Finck         HBITMAP IconToBitmap(HICON hIcon);
41c2c66affSColin Finck         VOID AddChooseProgramItem();
42c2c66affSColin Finck         VOID AddApp(PVOID pApp);
43c2c66affSColin Finck 
44c2c66affSColin Finck     public:
45c2c66affSColin Finck         COpenWithMenu();
46c2c66affSColin Finck         ~COpenWithMenu();
47c2c66affSColin Finck 
48c2c66affSColin Finck         // IContextMenu
49*49b2b1daSKatayama Hirofumi MZ         STDMETHOD(QueryContextMenu)(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override;
50*49b2b1daSKatayama Hirofumi MZ         STDMETHOD(InvokeCommand)(LPCMINVOKECOMMANDINFO lpcmi) override;
51*49b2b1daSKatayama Hirofumi MZ         STDMETHOD(GetCommandString)(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override;
52c2c66affSColin Finck 
53c2c66affSColin Finck         // IContextMenu2
54*49b2b1daSKatayama Hirofumi MZ         STDMETHOD(HandleMenuMsg)(UINT uMsg, WPARAM wParam, LPARAM lParam) override;
55c2c66affSColin Finck 
56c2c66affSColin Finck         // IShellExtInit
57*49b2b1daSKatayama Hirofumi MZ         STDMETHOD(Initialize)(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override;
58c2c66affSColin Finck 
59c2c66affSColin Finck         DECLARE_REGISTRY_RESOURCEID(IDR_OPENWITHMENU)
60c2c66affSColin Finck         DECLARE_NOT_AGGREGATABLE(COpenWithMenu)
61c2c66affSColin Finck 
62c2c66affSColin Finck         DECLARE_PROTECT_FINAL_CONSTRUCT()
63c2c66affSColin Finck 
64c2c66affSColin Finck         BEGIN_COM_MAP(COpenWithMenu)
65c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2)
66c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu)
67c2c66affSColin Finck         COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit)
68c2c66affSColin Finck         END_COM_MAP()
69c2c66affSColin Finck };
70c2c66affSColin Finck 
71c2c66affSColin Finck #endif /* _SHE_OCMENU_H_ */
72