-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathClassFactory.hpp
More file actions
37 lines (26 loc) · 774 Bytes
/
ClassFactory.hpp
File metadata and controls
37 lines (26 loc) · 774 Bytes
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
#pragma once
#include <comdef.h>
#include "TaskHandler.hpp"
//just in case I want to switch to another class for testing
#define COM_CLASS_NAME CTaskHandler
class ClassFactory : public IClassFactory
{
public:
ClassFactory()
{
InterlockedIncrement(&m_nRefCount);
}
~ClassFactory()
{
InterlockedDecrement(&m_nRefCount);
}
//IUnknown
STDMETHODIMP QueryInterface(_In_ REFIID riid, _COM_Outptr_ LPVOID* ppObj) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
//IClassFactory
STDMETHODIMP CreateInstance(_In_opt_ IUnknown* pUnknownOuter, _In_ REFIID riid, _COM_Outptr_ LPVOID* ppv);
STDMETHODIMP LockServer(_In_ BOOL bLock);
private:
long m_nRefCount;
};