-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThumbnailHandler.h
66 lines (51 loc) · 1.39 KB
/
ThumbnailHandler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// ThumbnailHandler.h : Declaration of the thumbnail handler
#pragma once
#include "resource.h" // main symbols
#include <atlhandler.h>
#include <atlhandlerimpl.h>
#include "..\JarredBrowser\JarredBrowserDoc.h"
#include "JarredBrowserHandlers_i.h"
using namespace ATL;
// CThumbnailHandler
class ATL_NO_VTABLE CThumbnailHandler :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CThumbnailHandler, &CLSID_Thumbnail>,
public CThumbnailProviderImpl
{
public:
CThumbnailHandler()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_THUMBNAIL_HANDLER)
DECLARE_NOT_AGGREGATABLE(CThumbnailHandler)
BEGIN_COM_MAP(CThumbnailHandler)
COM_INTERFACE_ENTRY(IInitializeWithStream)
COM_INTERFACE_ENTRY(IThumbnailProvider)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
CThumbnailProviderImpl::FinalRelease();
}
protected:
virtual HRESULT GetBitmap(UINT cx, HBITMAP *phbmp, WTS_ALPHATYPE *pdwAlpha)
{
if (m_pDocument == NULL)
{
return E_NOTIMPL;
}
// Implement OnDrawThumbnail in IDocument derived class
static int const nDocDimensions = 256;
if (!m_pDocument->GetThumbnail(nDocDimensions, phbmp, pdwAlpha))
{
return E_FAIL;
}
return S_OK;
}
DECLARE_DOCUMENT(CJarredBrowserDoc)
};
OBJECT_ENTRY_AUTO(__uuidof(Thumbnail), CThumbnailHandler)