#include "E:\\EClient\\W_liuhb_project\\xdjdj\\IModuleEx2.h"
int CPackageFactory::Initialize( base::IModContainer* container )
{
base::CSmartReleasePtr<base::IPkgFactory> pPkgFactory ( (base::IPkgFactory*)container->GetModule( IPKGFACTORY_MODULE_INTERFACE ), false );
pPkgFactory->LoadManager( pvPkgManager, L"" );
base::CSmartReleasePtr<base::deploy::IPkgManager> pvPkgManagerPtr(pvPkgManager, false);
pBinFile.SetPointer( (base::deploy::IBinFile*)pPkgFactory->CreateOperator( OPNAME_BINFILE ) );
if( !pBinFile.GetPointer() )
{
return S_FALSE;
}
GetAppSetting().from_xml( GetAppSetting().m_AppDataDir + L"\\appsettings.xml" );
// ITestEx* test =(ITestEx*)container->GetModule( L"testmodule" );
// test->Functest();
return S_OK;
}
int CPackageFactory::CreateBinFile( LPCWSTR PackageName, LPCWSTR SrcPath, BOOL bRar )
{
ShowInfo( L"Create Bin File: %s", PackageName );
DeleteFile ( PackageName );
UINT nVersion = bRar ? 1 : 0;
CString strVersion;
strVersion.Format( _T("<xml><version>%d</version></xml>"), nVersion );
pBinFile->Bind( pvPkgManager, NULL, strVersion );
int nRet = pBinFile->Load( PackageName );
if ( nRet == 0)
{
nRet = pBinFile->AddDir( SrcPath );
if ( nRet == 0)
{
nRet = pBinFile->Store();
}
}
return nRet;
int CPackageFactory::Initialize( base::IModContainer* container )
{
base::CSmartReleasePtr<base::IPkgFactory> pPkgFactory ( (base::IPkgFactory*)container->GetModule( IPKGFACTORY_MODULE_INTERFACE ), false );
pPkgFactory->LoadManager( pvPkgManager, L"" );
base::CSmartReleasePtr<base::deploy::IPkgManager> pvPkgManagerPtr(pvPkgManager, false);
pBinFile.SetPointer( (base::deploy::IBinFile*)pPkgFactory->CreateOperator( OPNAME_BINFILE ) );
if( !pBinFile.GetPointer() )
{
return S_FALSE;
}
GetAppSetting().from_xml( GetAppSetting().m_AppDataDir + L"\\appsettings.xml" );
// ITestEx* test =(ITestEx*)container->GetModule( L"testmodule" );
// test->Functest();
return S_OK;
}
int CPackageFactory::CreateBinFile( LPCWSTR PackageName, LPCWSTR SrcPath, BOOL bRar )
{
ShowInfo( L"Create Bin File: %s", PackageName );
DeleteFile ( PackageName );
UINT nVersion = bRar ? 1 : 0;
CString strVersion;
strVersion.Format( _T("<xml><version>%d</version></xml>"), nVersion );
pBinFile->Bind( pvPkgManager, NULL, strVersion );
int nRet = pBinFile->Load( PackageName );
if ( nRet == 0)
{
nRet = pBinFile->AddDir( SrcPath );
if ( nRet == 0)
{
nRet = pBinFile->Store();
}
}
return nRet;
}
config.xml 中:<module name="testmodule" dll="IModuled" function="CreateIModuletest"/>
dll中导出函数:extern "C" __declspec(dllexport) CIModuleChild* CreateIModuletest()
{
CIModuleChild* cImodule = new CIModuleChild;
return cImodule;
}