Skip to content

Commit 12ba451

Browse files
committed
Version 1.3.0
- Fix issues with file locking - Add using main composite image when document is small - Add using scaled down main composite image when thumbnail is missing - Add test application - Refactor thumbnail generation into separate file
1 parent d60f053 commit 12ba451

19 files changed

Lines changed: 1204 additions & 734 deletions

.gitignore

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
2-
Debug
3-
Release
4-
.vs
5-
*.sdf
6-
*.vcxproj.user
1+
2+
Debug
3+
Release
4+
.vs
5+
*.sdf
6+
*.vcxproj.user

LICENSE

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
The MIT License (MIT)
2-
3-
Copyright (c) 2015 Radosław Eichler
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
22-
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Radosław Eichler
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

PsdThumbnailProvider.sln

Lines changed: 88 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,88 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio 14
3-
VisualStudioVersion = 14.0.24720.0
4-
MinimumVisualStudioVersion = 10.0.40219.1
5-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C9250E0E-3B03-4029-ADF0-0FA8B1AEB70A}"
6-
EndProject
7-
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{EA1C995B-28A6-4036-911B-F83B361AC895}"
8-
EndProject
9-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PsdThumbnailProvider", "PsdThumbnailProvider\PsdThumbnailProvider.vcxproj", "{145AB33E-71A1-42C3-8223-E107CFC162F4}"
10-
EndProject
11-
Global
12-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
13-
Debug|Any CPU = Debug|Any CPU
14-
Debug|Mixed Platforms = Debug|Mixed Platforms
15-
Debug|Win32 = Debug|Win32
16-
Debug|x64 = Debug|x64
17-
Debug|x86 = Debug|x86
18-
Release|Any CPU = Release|Any CPU
19-
Release|Mixed Platforms = Release|Mixed Platforms
20-
Release|Win32 = Release|Win32
21-
Release|x64 = Release|x64
22-
Release|x86 = Release|x86
23-
EndGlobalSection
24-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
25-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Any CPU.ActiveCfg = Debug|x86
26-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
27-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Mixed Platforms.Build.0 = Debug|x86
28-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Win32.ActiveCfg = Debug|x86
29-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Win32.Build.0 = Debug|x86
30-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x64.ActiveCfg = Debug|x64
31-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x64.Build.0 = Debug|x64
32-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x86.ActiveCfg = Debug|x86
33-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x86.Build.0 = Debug|x86
34-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Any CPU.ActiveCfg = Release|x86
35-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Mixed Platforms.ActiveCfg = Release|x86
36-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Mixed Platforms.Build.0 = Release|x86
37-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Win32.ActiveCfg = Release|x86
38-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Win32.Build.0 = Release|x86
39-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x64.ActiveCfg = Release|x64
40-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x64.Build.0 = Release|x64
41-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x86.ActiveCfg = Release|x86
42-
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x86.Build.0 = Release|x86
43-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Any CPU.ActiveCfg = Debug|Win32
44-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
45-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
46-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Win32.ActiveCfg = Debug|Win32
47-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Win32.Build.0 = Debug|Win32
48-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x64.ActiveCfg = Debug|x64
49-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x64.Build.0 = Debug|x64
50-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x86.ActiveCfg = Debug|Win32
51-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x86.Build.0 = Debug|Win32
52-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Any CPU.ActiveCfg = Release|Win32
53-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
54-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Mixed Platforms.Build.0 = Release|Win32
55-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Win32.ActiveCfg = Release|Win32
56-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Win32.Build.0 = Release|Win32
57-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x64.ActiveCfg = Release|x64
58-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x64.Build.0 = Release|x64
59-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x86.ActiveCfg = Release|Win32
60-
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x86.Build.0 = Release|Win32
61-
EndGlobalSection
62-
GlobalSection(SolutionProperties) = preSolution
63-
HideSolutionNode = FALSE
64-
EndGlobalSection
65-
EndGlobal
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio 15
3+
VisualStudioVersion = 15.0.28307.168
4+
MinimumVisualStudioVersion = 10.0.40219.1
5+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C9250E0E-3B03-4029-ADF0-0FA8B1AEB70A}"
6+
EndProject
7+
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{EA1C995B-28A6-4036-911B-F83B361AC895}"
8+
EndProject
9+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PsdThumbnailProvider", "PsdThumbnailProvider\PsdThumbnailProvider.vcxproj", "{145AB33E-71A1-42C3-8223-E107CFC162F4}"
10+
EndProject
11+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test\Test.vcxproj", "{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}"
12+
EndProject
13+
Global
14+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
15+
Debug|Any CPU = Debug|Any CPU
16+
Debug|Mixed Platforms = Debug|Mixed Platforms
17+
Debug|Win32 = Debug|Win32
18+
Debug|x64 = Debug|x64
19+
Debug|x86 = Debug|x86
20+
Release|Any CPU = Release|Any CPU
21+
Release|Mixed Platforms = Release|Mixed Platforms
22+
Release|Win32 = Release|Win32
23+
Release|x64 = Release|x64
24+
Release|x86 = Release|x86
25+
EndGlobalSection
26+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
27+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Any CPU.ActiveCfg = Debug|x86
28+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
29+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Mixed Platforms.Build.0 = Debug|x86
30+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Win32.ActiveCfg = Debug|x86
31+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|Win32.Build.0 = Debug|x86
32+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x64.ActiveCfg = Debug|x64
33+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x64.Build.0 = Debug|x64
34+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x86.ActiveCfg = Debug|x86
35+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Debug|x86.Build.0 = Debug|x86
36+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Any CPU.ActiveCfg = Release|x86
37+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Mixed Platforms.ActiveCfg = Release|x86
38+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Mixed Platforms.Build.0 = Release|x86
39+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Win32.ActiveCfg = Release|x86
40+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|Win32.Build.0 = Release|x86
41+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x64.ActiveCfg = Release|x64
42+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x64.Build.0 = Release|x64
43+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x86.ActiveCfg = Release|x86
44+
{EA1C995B-28A6-4036-911B-F83B361AC895}.Release|x86.Build.0 = Release|x86
45+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Any CPU.ActiveCfg = Debug|Win32
46+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
47+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Mixed Platforms.Build.0 = Debug|Win32
48+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Win32.ActiveCfg = Debug|Win32
49+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|Win32.Build.0 = Debug|Win32
50+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x64.ActiveCfg = Debug|x64
51+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x64.Build.0 = Debug|x64
52+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x86.ActiveCfg = Debug|Win32
53+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Debug|x86.Build.0 = Debug|Win32
54+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Any CPU.ActiveCfg = Release|Win32
55+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Mixed Platforms.ActiveCfg = Release|Win32
56+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Mixed Platforms.Build.0 = Release|Win32
57+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Win32.ActiveCfg = Release|Win32
58+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|Win32.Build.0 = Release|Win32
59+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x64.ActiveCfg = Release|x64
60+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x64.Build.0 = Release|x64
61+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x86.ActiveCfg = Release|Win32
62+
{145AB33E-71A1-42C3-8223-E107CFC162F4}.Release|x86.Build.0 = Release|Win32
63+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|Any CPU.ActiveCfg = Debug|Win32
64+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
65+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|Mixed Platforms.Build.0 = Debug|Win32
66+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|Win32.ActiveCfg = Debug|Win32
67+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|Win32.Build.0 = Debug|Win32
68+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|x64.ActiveCfg = Debug|x64
69+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|x64.Build.0 = Debug|x64
70+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|x86.ActiveCfg = Debug|Win32
71+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Debug|x86.Build.0 = Debug|Win32
72+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|Any CPU.ActiveCfg = Release|Win32
73+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|Mixed Platforms.ActiveCfg = Release|Win32
74+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|Mixed Platforms.Build.0 = Release|Win32
75+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|Win32.ActiveCfg = Release|Win32
76+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|Win32.Build.0 = Release|Win32
77+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|x64.ActiveCfg = Debug|x64
78+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|x64.Build.0 = Debug|x64
79+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|x86.ActiveCfg = Release|Win32
80+
{998FCBFC-78A6-4DE9-9F94-6D4762B445D7}.Release|x86.Build.0 = Release|Win32
81+
EndGlobalSection
82+
GlobalSection(SolutionProperties) = preSolution
83+
HideSolutionNode = FALSE
84+
EndGlobalSection
85+
GlobalSection(ExtensibilityGlobals) = postSolution
86+
SolutionGuid = {61AA6387-FF05-4307-90D6-1E72C5200D6C}
87+
EndGlobalSection
88+
EndGlobal
Lines changed: 69 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,69 @@
1-
#include "ClassFactory.h"
2-
#include "PsdThumbnailProvider.h"
3-
#include <new>
4-
#include <Shlwapi.h>
5-
#pragma comment(lib, "shlwapi.lib")
6-
7-
extern long g_cDllRef;
8-
9-
ClassFactory::ClassFactory() : m_cRef(1) {
10-
InterlockedIncrement(&g_cDllRef);
11-
}
12-
13-
ClassFactory::~ClassFactory() {
14-
InterlockedDecrement(&g_cDllRef);
15-
}
16-
17-
// IUnknown
18-
19-
IFACEMETHODIMP ClassFactory::QueryInterface(REFIID riid, void **ppv) {
20-
static const QITAB qit[] =
21-
{
22-
QITABENT(ClassFactory, IClassFactory),
23-
{ 0 },
24-
};
25-
return QISearch(this, qit, riid, ppv);
26-
}
27-
28-
IFACEMETHODIMP_(ULONG) ClassFactory::AddRef() {
29-
return InterlockedIncrement(&m_cRef);
30-
}
31-
32-
IFACEMETHODIMP_(ULONG) ClassFactory::Release() {
33-
ULONG cRef = InterlockedDecrement(&m_cRef);
34-
if (0 == cRef) {
35-
delete this;
36-
}
37-
return cRef;
38-
}
39-
40-
// IClassFactory
41-
42-
IFACEMETHODIMP ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv) {
43-
HRESULT hr = CLASS_E_NOAGGREGATION;
44-
45-
// pUnkOuter is used for aggregation. We do not support it in the sample.
46-
if (pUnkOuter == NULL) {
47-
hr = E_OUTOFMEMORY;
48-
49-
// Create the COM component.
50-
PsdThumbnailProvider *pExt = new (std::nothrow) PsdThumbnailProvider();
51-
52-
if (pExt) {
53-
// Query the specified interface.
54-
hr = pExt->QueryInterface(riid, ppv);
55-
pExt->Release();
56-
}
57-
}
58-
59-
return hr;
60-
}
61-
62-
IFACEMETHODIMP ClassFactory::LockServer(BOOL fLock) {
63-
if (fLock) {
64-
InterlockedIncrement(&g_cDllRef);
65-
} else {
66-
InterlockedDecrement(&g_cDllRef);
67-
}
68-
return S_OK;
69-
}
1+
#include "ClassFactory.h"
2+
#include "PsdThumbnailProvider.h"
3+
#include <new>
4+
#include <Shlwapi.h>
5+
#pragma comment(lib, "shlwapi.lib")
6+
7+
extern long g_cDllRef;
8+
9+
ClassFactory::ClassFactory() : m_cRef(1) {
10+
InterlockedIncrement(&g_cDllRef);
11+
}
12+
13+
ClassFactory::~ClassFactory() {
14+
InterlockedDecrement(&g_cDllRef);
15+
}
16+
17+
// IUnknown
18+
19+
IFACEMETHODIMP ClassFactory::QueryInterface(REFIID riid, void **ppv) {
20+
static const QITAB qit[] =
21+
{
22+
QITABENT(ClassFactory, IClassFactory),
23+
{ 0 },
24+
};
25+
return QISearch(this, qit, riid, ppv);
26+
}
27+
28+
IFACEMETHODIMP_(ULONG) ClassFactory::AddRef() {
29+
return InterlockedIncrement(&m_cRef);
30+
}
31+
32+
IFACEMETHODIMP_(ULONG) ClassFactory::Release() {
33+
ULONG cRef = InterlockedDecrement(&m_cRef);
34+
if (0 == cRef) {
35+
delete this;
36+
}
37+
return cRef;
38+
}
39+
40+
// IClassFactory
41+
42+
IFACEMETHODIMP ClassFactory::CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv) {
43+
HRESULT hr = CLASS_E_NOAGGREGATION;
44+
45+
// pUnkOuter is used for aggregation. We do not support it in the sample.
46+
if (pUnkOuter == NULL) {
47+
hr = E_OUTOFMEMORY;
48+
49+
// Create the COM component.
50+
PsdThumbnailProvider *pExt = new (std::nothrow) PsdThumbnailProvider();
51+
52+
if (pExt) {
53+
// Query the specified interface.
54+
hr = pExt->QueryInterface(riid, ppv);
55+
pExt->Release();
56+
}
57+
}
58+
59+
return hr;
60+
}
61+
62+
IFACEMETHODIMP ClassFactory::LockServer(BOOL fLock) {
63+
if (fLock) {
64+
InterlockedIncrement(&g_cDllRef);
65+
} else {
66+
InterlockedDecrement(&g_cDllRef);
67+
}
68+
return S_OK;
69+
}
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
#pragma once
2-
3-
#include <unknwn.h> // For IClassFactory
4-
#include <windows.h>
5-
6-
class ClassFactory : public IClassFactory {
7-
public:
8-
// IUnknown
9-
IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
10-
IFACEMETHODIMP_(ULONG) AddRef();
11-
IFACEMETHODIMP_(ULONG) Release();
12-
13-
// IClassFactory
14-
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
15-
IFACEMETHODIMP LockServer(BOOL fLock);
16-
17-
ClassFactory();
18-
19-
protected:
20-
~ClassFactory();
21-
22-
private:
23-
long m_cRef;
24-
};
1+
#pragma once
2+
3+
#include <unknwn.h> // For IClassFactory
4+
#include <windows.h>
5+
6+
class ClassFactory : public IClassFactory {
7+
public:
8+
// IUnknown
9+
IFACEMETHODIMP QueryInterface(REFIID riid, void **ppv);
10+
IFACEMETHODIMP_(ULONG) AddRef();
11+
IFACEMETHODIMP_(ULONG) Release();
12+
13+
// IClassFactory
14+
IFACEMETHODIMP CreateInstance(IUnknown *pUnkOuter, REFIID riid, void **ppv);
15+
IFACEMETHODIMP LockServer(BOOL fLock);
16+
17+
ClassFactory();
18+
19+
protected:
20+
~ClassFactory();
21+
22+
private:
23+
long m_cRef;
24+
};

0 commit comments

Comments
 (0)