配置文件,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;
}
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;
}
相关文章推荐
- 使用Gradle构建SpringBoot工程系列:第四篇:项目初始化(编辑build.gradle文件,引入项目基本配置及依赖)
- web工程中普通 java 类使用 properties 配置文件中属性
- 使用汇编取得PE文件导入的DLL名称和函数名称
- [导入].Net2.0 使用ConfigurationManager读写配置文件
- java工程使用log4j和properties文件详细配置
- eclipse的Format配置文件xml格式化标准,可直接导入使用ctrl+shift+F
- 使用struct模块从定宽数据文件导入数据
- Spring-property文件配置方法以及如何与工程分离~xml使用${}
- [开源项目-MyBean轻量级配置框架] 使用MyBean快速搭建分模块的应用程序(主页面的TAB)(DLL-MDI)
- Maven命令详解 模块导入 MyEclipse + Maven开发Web工程的详细配置过程
- iOS开发:给项目工程里面添加Podfile配置文件,以及CocoaPods的简单使用
- MFC工程中导入使用已有的.h文件和.cpp文件
- UEFI原理与编程(四):UEFI工程模块文件-使用main函数的应用程序工程模块
- Python配置文件解析模块ConfigParser使用实例
- 如何 在Spring MVC中 使用多个Spring和MyBatis的xml配置文件(多模块配置)
- python 使用模块augeas修改类似a=b的配置文件
- 没有eclipse|myeclipse配置文件的情况下导入java web工程文件
- 使用xlrd模块从excel文件中导入数据
- 没有eclipse|myeclipse配置文件的情况下导入java web工程文件
- iOS开发:给项目工程里面添加Podfile配置文件,以及CocoaPods的简单使用