Click here to Skip to main content
15,892,517 members
Articles / Programming Languages / C++

Listing Used Files

Rate me:
Please Sign up or sign in to vote.
4.81/5 (95 votes)
29 Sep 2010CPOL11 min read 635.6K   23.2K   220  
A ShellExtension that lists all the used files in a folder.
// InterFaceCls.h : Declaration of the CInterFaceCls

#pragma once
#include "resource.h"       // main symbols
#include <shlobj.h>
#include <comdef.h>
#include "OpenFileFinder.h"


#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif



// CInterFaceCls

class ATL_NO_VTABLE CInterFaceCls :
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CInterFaceCls, &CLSID_InterFaceCls>,
	//public IInterFaceCls
	public IShellExtInit,
	public IContextMenu
{
public:
	CInterFaceCls()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_INTERFACECLS)

DECLARE_NOT_AGGREGATABLE(CInterFaceCls)

BEGIN_COM_MAP(CInterFaceCls)
	//COM_INTERFACE_ENTRY(IInterFaceCls)
	COM_INTERFACE_ENTRY(IShellExtInit)
	COM_INTERFACE_ENTRY(IContextMenu)
END_COM_MAP()



	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}

	void FinalRelease()
	{
	}

public:

	STDMETHODIMP Initialize( LPCITEMIDLIST pidlFolder, LPDATAOBJECT pDataObj, HKEY hProgID );
	
	STDMETHODIMP GetCommandString( UINT_PTR idCmd, UINT uFlags, UINT* pwReserved, LPSTR pszName, UINT cchMax );

	STDMETHODIMP InvokeCommand( LPCMINVOKECOMMANDINFO pCmdInfo );

	STDMETHODIMP QueryContextMenu( HMENU hmenu, UINT uMenuIndex, UINT uidFirstCmd, UINT uidLastCmd, UINT uFlags );

private:

	CString m_csPath;
};

OBJECT_ENTRY_AUTO(__uuidof(InterFaceCls), CInterFaceCls)

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 Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Australia Australia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions