MPF源码分析之资源文件加载

    本文将分析MPF客户端框架中资源文件相关的源代码,以github包中提供的qq界面demo作为

起点,一步一步分析程序的运行原理;

主程序很简单,代码如下:

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
suic::InitUIWgxs(true);
suic::InitUILogLevel(suic::LogLevel::Trace);

suic::BuildFactory::Ins()->Add(ChatTextBox::RTTIType());

suic::WindowPtr wnd(new MainWindow());

try
{
// 加载资源文件
suic::ThemeOp::SetSystemTheme("default.sres", "wr");
suic::String strApp = _T("QQ/Layout/Application.xml");

// 载入布局资源并运行系统
suic::Application::RunApp(wnd.get(), strApp.c_str());
}
catch(suic::Exception& e)
{
suic::String err = e.GetErrorMsg();
}

wnd = NULL;

suic::ExitUIWgx();

return 0;
}

先看框架的初始化函数suic::InitUIWgxs(true),函数实现代码如下:

SUIWGX_API bool __stdcall InitUIWgxs(bool initWgx)
{
if (!s_g_init)
{
suic::BuildFactory::Ins()->RegisterAddType(new WgxAddType());
suic::InitUICore();
::OleInitialize(NULL);
//suic::BuildFactory::Ins()->Add();
suic::InfoBox::StaticInit();
if (initWgx)
{
InitUIControls();
}
s_g_init = true;
}

return true;
}

 

 

 

 

 

 

 

 

 

 

原文地址:https://www.cnblogs.com/skiing886/p/8003875.html