Click here to Skip to main content
15,894,330 members
Articles / Desktop Programming / MFC

Create Thumbnail Extractor Objects for Your MFC Document Types

Rate me:
Please Sign up or sign in to vote.
4.94/5 (23 votes)
21 Nov 20025 min read 356.2K   4.3K   104  
An article on writing thumbnail shell extensions for your MFC document types
// ScribbleExtractor.h : Declaration of the CScribbleExtractor

#ifndef __SCRIBBLEEXTRACTOR_H_
#define __SCRIBBLEEXTRACTOR_H_

#include "resource.h"				// main symbols
#include <shlguid.h>
#include <AtlCom.h>
#include <shlobj.h>
//#include <shobjidl.h>
#include "IExtractImage.h"

/////////////////////////////////////////////////////////////////////////////
// CScribbleExtractor
class ATL_NO_VTABLE CScribbleExtractor : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CScribbleExtractor, &CLSID_ScribbleExtractor>,
	public IPersistFile,
	public IExtractImage2
{
public:
	CScribbleExtractor()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_THUMBSCB)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CScribbleExtractor)
	COM_INTERFACE_ENTRY(IPersistFile)
	COM_INTERFACE_ENTRY(IExtractImage)
	COM_INTERFACE_ENTRY(IExtractImage2)
END_COM_MAP()

// IExtractImage
public:

	STDMETHOD(GetLocation)(LPWSTR pszPathBuffer,
						   DWORD cchMax,
						   DWORD *pdwPriority,
						   const SIZE *prgSize,
						   DWORD dwRecClrDepth,
						   DWORD *pdwFlags);
	STDMETHOD(Extract)(HBITMAP*);
// IExtractImage2
  STDMETHOD(GetDateStamp)(FILETIME *pDateStamp);

// IPersistFile
	STDMETHOD(Load)(LPCOLESTR wszFile, DWORD dwMode);

	STDMETHOD(GetClassID)(LPCLSID clsid)
		{ MessageBox(0,"GetClassID",0,0);

		return E_NOTIMPL;	}

	STDMETHOD(IsDirty)(VOID)
	{ MessageBox(0,"IsDirty",0,0);
	return E_NOTIMPL; }

	STDMETHOD(Save)(LPCOLESTR, BOOL)
	{ 		MessageBox(0,"Save",0,0);
		return E_NOTIMPL; }

	STDMETHOD(SaveCompleted)(LPCOLESTR)
	{ 
		MessageBox(0,"SaveCompleted",0,0);
		return E_NOTIMPL; }

	STDMETHOD(GetCurFile)(LPOLESTR FAR*)
	{ MessageBox(0,"GetCurFile",0,0);
		return E_NOTIMPL; }

private:
	SIZE m_bmSize;
	HBITMAP m_hPreview;
	TCHAR m_szFile[500];
};

#endif //__ICONEXTRACTOR_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.


Written By
Web Developer Forthnet
Greece Greece
Software developer and Microsoft Trainer, Athens, Greece (MCT, MCSD.net, MCSE 2003, MCDBA 2000,MCTS, MCITP, MCIPD).

Comments and Discussions