?? kaeziparchivefactory.cpp
字號(hào):
#include "stdafx.h"
#include "KAEZipArchive.h"
#include "KAEZipArchiveImplement.h"
#include "KAEZipArchiveComponent.h"
#include "KAEZipArchiveFactory.h"
static unsigned g_uServerLocks = 0;
HRESULT STDMETHODCALLTYPE KAEZipArchiveFactory::CreateInstance(
/* [unique][in] */ IUnknown __RPC_FAR *pUnkOuter,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject
)
{
if (pUnkOuter)
return KSCOM_CLASS_E_NOAGGREGATION; // E_NO_AGGREGATION
KAEZipArchiveComponent *pKAEZipArchiveComponent = NULL;
pKAEZipArchiveComponent = new KAEZipArchiveComponent();
if (!pKAEZipArchiveComponent)
return KSCOM_E_OUTOFMEMORY;
KSCOMRESULT kr = pKAEZipArchiveComponent->QueryInterface(riid, ppvObject);
pKAEZipArchiveComponent->Release();
return kr;
}
HRESULT STDMETHODCALLTYPE KAEZipArchiveFactory::LockServer(
/* [in] */ BOOL fLock
)
{
if (fLock)
g_uServerLocks ++;
else
g_uServerLocks --;
return KSCOM_S_OK;
}
// =========================================================================
// * COM Component Implement Public Part *
// =========================================================================
HRESULT STDMETHODCALLTYPE KAEZipArchiveFactory::QueryInterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject)
{
ASSERT(ppvObject);
*ppvObject = NULL;
if (KSCOM_EQUAL_UUID(riid, IID_IUnknown) ||
KSCOM_EQUAL_UUID(riid, IID_IClassFactory)
)
{
*ppvObject = (void *)this;
}
else
return KSCOM_E_NOINTERFACE;
((IUnknown *)(*ppvObject))->AddRef();
return KSCOM_S_OK;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -