I used VS2015 and the ATL project wizard to write a Shell Extension Icon handler. I created a COM object to expose the IPersist and IExtractIcon interfaces. I can see that the handler is registered when I look at the registry entry for the specific file type. Here’s what the class looks like:
class ATL_NO_VTABLE CIconHandlerExt :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CIconHandlerExt, &CLSID_IconHandlerExt>,
public IIconHandlerExt,
public IPersistFile,
public IExtractIcon
{
public:
CIconHandlerExt()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_ICONHANDLEREXT)
DECLARE_NOT_AGGREGATABLE(CIconHandlerExt)
BEGIN_COM_MAP(CIconHandlerExt)
COM_INTERFACE_ENTRY(IIconHandlerExt)
COM_INTERFACE_ENTRY(IPersistFile)
COM_INTERFACE_ENTRY(IExtractIcon)
END_COM_MAP()
// IIconHandlerExt
public:
// IExtractIcon
STDMETHODIMP GetIconLocation(UINT uFlags, LPTSTR szIconFile, UINT cchMax, int* piIndex, UINT* pwFlags);
STDMETHODIMP Extract(LPCTSTR pszFile, UINT nIconIndex, HICON* phiconLarge, HICON* phiconSmall, UINT nIconSize);
public:
// IPersistFile
//xxxSTDMETHOD(GetClassID)(CLSID*) { return E_NOTIMPL; }
STDMETHOD(GetClassID)(CLSID *pClsId) { *pClsId = CLSID_IconHandlerExt; return S_OK; }
STDMETHOD(IsDirty)() { return E_NOTIMPL; }
STDMETHOD(Save)(LPCOLESTR, BOOL) { return E_NOTIMPL; }
STDMETHOD(SaveCompleted)(LPCOLESTR) { return E_NOTIMPL; }
STDMETHOD(GetCurFile)(LPOLESTR*) { return E_NOTIMPL; }
STDMETHOD(Load)(LPCOLESTR wszFile, DWORD /*dwMode*/)
{
USES_CONVERSION;
lstrcpyn(m_szFilename, OLE2CT(wszFile), MAX_PATH);
return S_OK;
}
protected:
TCHAR m_szFilename[MAX_PATH]; // Full path to the file in question.
};
OBJECT_ENTRY_AUTO(__uuidof(IconHandlerExt), CIconHandlerExt)
I used the instructions in this post to start the debugging session. Namely, I click the task bar, hit Alt-F4, Press Ctrl-Alt-Shift-Escape, and start my debugger session that specifies Windows Explorer as the command target. I set breakpoints and navigate to the test file.
My handler is never loaded since the breakpoints are not hit and they say
“The breakpoint will not currently be hit. No symbols have been loaded for this document.”
Can anyone shed light on why my extension does not load?