您的位置:首页 > 其它

配置文件,dll导入到工程中,并使用该模块

2012-05-30 16:36 369 查看
#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;
}

config.xml 中:<module name="testmodule" dll="IModuled" function="CreateIModuletest"/>

dll中导出函数:extern "C"  __declspec(dllexport) CIModuleChild* CreateIModuletest()

{
CIModuleChild* cImodule = new CIModuleChild; 
return cImodule;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐