Click here to Skip to main content
15,886,519 members
Articles / Desktop Programming / ATL

A File Checksum Shell Menu Extension DLL

Rate me:
Please Sign up or sign in to vote.
4.89/5 (34 votes)
23 May 2008LGPL315 min read 251.1K   6K   116  
Create a File Checksum Shell Menu Extension using ATL and Crypto++
// MenuItem.h : Declaration of the CMenuItem

#ifndef __MENUITEM_H_
#define __MENUITEM_H_

#include "resource.h"       // main symbols

#include <shlobj.h>
#include <comdef.h>

#include <string>

/////////////////////////////////////////////////////////////////////////////
// CMenuItem
class ATL_NO_VTABLE CMenuItem : 
    public CComObjectRootEx<CComSingleThreadModel>,
    public CComCoClass<CMenuItem, &CLSID_MenuItem>,
    // public IMenuItem
    public IShellExtInit,
    public IContextMenu
{
public:
	CMenuItem() { }

protected:
    std::basic_string<TCHAR> file;

public:
    // IShellExtInit
    STDMETHODIMP Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY);

public:
    // IContextMenu
    STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO);
    STDMETHODIMP GetCommandString(UINT, UINT, UINT*, LPSTR, UINT);
    STDMETHODIMP QueryContextMenu(HMENU, UINT, UINT, UINT, UINT);

DECLARE_REGISTRY_RESOURCEID(IDR_MENUITEM)
DECLARE_NOT_AGGREGATABLE(CMenuItem)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CMenuItem)
	// COM_INTERFACE_ENTRY(IMenuItem)
    COM_INTERFACE_ENTRY(IShellExtInit)
    COM_INTERFACE_ENTRY(IContextMenu)
END_COM_MAP()

// IMenuItem
public:
};

#endif //__MENUITEM_H_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Systems / Hardware Administrator
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions