Click here to Skip to main content
15,881,248 members
Articles / Desktop Programming / ATL

Shell Extensions for .NET Assemblies

Rate me:
Please Sign up or sign in to vote.
4.98/5 (29 votes)
17 Nov 2005Ms-PL3 min read 183.8K   2.6K   81  
Shell extensions to distinguish between .NET assemblies and Win32 applications and libraries.
// AssemblyIconOverlay.h : Declaration of the CAssemblyIconOverlay

#pragma once
#include "resource.h"       // main symbols
#include "AsmShell.h"
#include "rgsmap.h"

EXTERN_C const CLSID CLSID_AssemblyIconOverlay;

// CAssemblyIconOverlay

class ATL_NO_VTABLE CAssemblyIconOverlay : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CAssemblyIconOverlay, &CLSID_AssemblyIconOverlay>,
	public IShellIconOverlayIdentifier
{
public:
	CAssemblyIconOverlay()
	{
	}

DECLARE_REGISTRY_RESOURCEID_EX(IDR_ASSEMBLYICONOVERLAY)

BEGIN_REGISTRY_MAP(CAssemblyIconOverlay)
	REGISTRY_GUID("CLSID", CLSID_AssemblyIconOverlay)
END_REGISTRY_MAP()

BEGIN_COM_MAP(CAssemblyIconOverlay)
	COM_INTERFACE_ENTRY_IID(IID_IShellIconOverlayIdentifier, IShellIconOverlayIdentifier)
END_COM_MAP()

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		HRESULT hr;

		hr = m_spAsmInfo.CoCreateInstance(CLSID_AssemblyInfo);
		return hr;
	}
	
	void FinalRelease()
	{
	}

public:

	// IShellIconOverlayIdentifier methods
	STDMETHOD(GetOverlayInfo)(LPWSTR pwszIconFile, int cchMax, int *pIndex, DWORD *pdwFlags);
	STDMETHOD(GetPriority)(int *pPriority);
	STDMETHOD(IsMemberOf)(LPCWSTR pwszPath, DWORD dwAttrib);

private:
	CComPtr<IAssemblyInfo> m_spAsmInfo;

};

OBJECT_ENTRY_AUTO(CLSID_AssemblyIconOverlay, CAssemblyIconOverlay)

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 Microsoft Public License (Ms-PL)


Written By
Software Developer Microsoft
United States United States
Principal Software Engineer currently working on Azure SDKs at Microsoft. My opinions are my own. I work on a number of OSS projects for work and personally in numerous languages including C++, C#, JavaScript, Go, Rust, et. al. See a problem, fix a problem (or at least create an issue)!

Avid outdoor adventurer 🏔️❄️👞🚴‍♂️, husband, father.

Comments and Discussions