?? kaeziparchiveregister.cpp
字號:
//////////////////////////////////////////////////////////////////////////////////////
//
// FileName : KAEZipArchiveRegister.h
// Creater : Liu Haifeng
// Date : 2000-07-27 16:51:20
// Comment : Use to register KAEZipArchive Component to KSCOM
//
//////////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "KAEZipArchive.h"
#include "KAEZipArchiveRegister.h"
static HANDLE g_hKAEZipArchiveComponent = NULL;
#ifdef _KAV_COMPONENT_REG_FACTORY_
#include "KAEZipArchiveFactory.h"
static int g_nRegFactory = 0;
KSCOMRESULT KAEZipArchiveRegFactory()
{
if (g_nRegFactory > 0)
{
g_nRegFactory++;
return KSCOM_S_OK;
}
KSCOMRESULT krResult = KSCOM_E_FAIL;
KSCOMRESULT krRetCode = KSCOM_E_FAIL;
KAEZipArchiveFactory *pcNameFactory = NULL;
pcNameFactory = new KAEZipArchiveFactory();
if (!pcNameFactory)
goto Exit0;
krRetCode = KSCoRegisterClassObject(CLSID_KAEZipArchive, IID_IClassFactory, pcNameFactory, &g_hKAEZipArchiveComponent);
if (FAILED(krRetCode))
{
krResult = krRetCode;
goto Exit0;
}
g_nRegFactory++;
krResult = KSCOM_S_OK;
Exit0:
if (pcNameFactory)
{
pcNameFactory->Release();
pcNameFactory = NULL;
}
return krResult;
}
KSCOMRESULT KAEZipArchiveUnRegFactory()
{
if (g_nRegFactory <= 0)
return KSCOM_E_FAIL;
g_nRegFactory--;
if (g_nRegFactory > 0)
return KSCOM_S_OK;
KSCOMRESULT krResult = KSCOM_S_OK;
if (g_hKAEZipArchiveComponent)
{
krResult = KSCoUnRegisterClassObject(g_hKAEZipArchiveComponent);
g_hKAEZipArchiveComponent = NULL;
}
return krResult;
}
#elif _KAV_COMPONENT_REG_FILE_
static int g_nRegFile = 0;
KSCOMRESULT KAEZipArchiveRegFile()
{
if (g_nRegFile > 0)
{
g_nRegFile++;
return KSCOM_S_OK;
}
KSCOMRESULT krResult = KSCOM_E_FAIL;
KSCOMRESULT krRetCode = KSCOM_E_FAIL;
krRetCode = KSCoRegisterComponent(
CLSID_KAEZipArchive,
IID_IClassFactory,
REGISTER_COMPONENT_FILENAME,
0,
KAEZIPARCHIVE_FILENAME,
&g_hKAEZipArchiveComponent
);
if (FAILED(krRetCode))
{
krResult = krRetCode;
goto Exit0;
}
g_nRegFile++;
krResult = KSCOM_S_OK;
Exit0:
return krResult;
}
KSCOMRESULT KAEZipArchiveUnRegFile()
{
if (g_nRegFile <= 0)
return KSCOM_E_FAIL;
g_nRegFile--;
if (g_nRegFile > 0)
return KSCOM_S_OK;
KSCOMRESULT krResult = KSCOM_S_OK;
if (g_hKAEZipArchiveComponent)
{
krResult = KSCoUnRegisterComponent(g_hKAEZipArchiveComponent);
g_hKAEZipArchiveComponent = NULL;
}
return krResult;
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -