資源簡介
《DUILIB加載XML界面》對應源碼,博客地址:http://blog.csdn.net/harvic880925/article/details/8920326,有興趣的朋友可以去看看

代碼片段和文件信息
//?blog_try.cpp?:?定義應用程序的入口點。
//
#include?“stdafx.h“
#include?“blog_try.h“
CMainframe::CMainframe(void)
{
}
CMainframe::~CMainframe(void)
{
}
LPCTSTR?CMainframe::GetWindowClassName()?const?//重寫獲取類名函數,也就是指定要新建的窗口類的類名
{?
return?_T(“UIMainframe“);?
};
UINT?const?CMainframe::GetClassstyle()??//重寫這個函數,來指定窗口樣式
{?
return?UI_CLASSstyle_frame?|?CS_DBLCLKS;?
};
void?CMainframe::OnPrepare()?
{
}
void?CMainframe::Notify(TNotifyUI&?msg)//處理窗口通知消息,響應用戶的輸入
{
if(?msg.sType?==?_T(“windowinit“)?)?OnPrepare();
}
LRESULT?CMainframe::OnCreate(UINT?uMsg?WPARAM?wParam?LPARAM?lParam?BOOL&?bHandled){
LONG?styleValue?=?::GetWindowLong(*this?GWL_style);
styleValue?&=?~WS_CAPTION;
::SetWindowLong(*this?GWL_style?styleValue?|?WS_CLIPSIBLINGS?|?WS_CLIPCHILDREN);
m_pm.Init(m_hWnd);//主窗口類與窗口句柄關聯
CDialogBuilder?builder;
CControlUI*?pRoot?=?builder.Create(_T(“UISkin.xml“)?(UINT)0?NULL?&m_pm);//加載xml并動態創建界面無素,與布局界面元素,核心函數單獨分析
//注意:CDialogBuilder?并不是一個對話框類
ASSERT(pRoot?&&?“Failed?to?parse?xml“);
if?(NULL==pRoot)//如果找不到皮膚文件則退出
{
MessageBox(NULLTEXT(“Cant?not?find?the?skin!“)NULLMB_ICONHAND);
return?0;
}
m_pm.AttachDialog(pRoot);//附加控件數據到HASH表中……為pRoot作為對話框結點,為其創建控件樹
m_pm.AddNotifier(this);//增加通知處理
return?0;
}
LRESULT?CMainframe::HandleMessage(UINT?uMsg?WPARAM?wParam?LPARAM?lParam)
{
LRESULT?lRes?=?0;
BOOL?bHandled?=?TRUE;
switch(?uMsg?)?{
case?WM_CREATE:?
lRes?=?OnCreate(uMsg?wParam?lParam?bHandled);?
break;
default:
bHandled?=?FALSE;
}
if(?bHandled?)?return?lRes;
if(?m_pm.MessageHandler(uMsg?wParam?lParam?lRes)?)?return?lRes;
return?CWindowWnd::HandleMessage(uMsg?wParam?lParam);
}
int?APIENTRY?_tWinMain(HINSTANCE?hInstance
?????????????????????HINSTANCE?hPrevInstance
?????????????????????LPTSTR????lpCmdLine
?????????????????????int???????nCmdShow)
{
CPaintManagerUI::SetInstance(hInstance);//設置程序實例
CPaintManagerUI::SetResourcePath(CPaintManagerUI::GetInstancePath()?
+?_T(“skin“));//實例句柄與渲染類關聯獲得皮膚文件目錄(加載皮膚文件在OnCreate之中)
HRESULT?Hr?=?::CoInitialize(NULL);//初始化COM庫?為加載COM庫提供支持
if(?FAILED(Hr)?)?
return?0;
CMainframe*?pMainframe?=?new?CMainframe();//創建應用程序窗口類對象
if(?pMainframe?==?NULL?)?
return?0;
pMainframe->Create(NULL?_T(“AdderCalc“)?UI_WNDstyle_DIALOG?0);
pMainframe->CenterWindow();//將窗口放到桌面中央
pMainframe->ShowWindow(true);//顯示窗口
CPaintManagerUI::MessageLoop();//進入消息循環
::CoUninitialize();//退出程序并釋放COM庫
return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2763??2013-05-13?13:41??blog_try\blog_try\blog_try.cpp
?????文件????????564??2013-05-13?13:39??blog_try\blog_try\blog_try.h
????.......?????23558??2003-07-24?09:52??blog_try\blog_try\blog_try.ico
?????文件???????3374??2013-05-13?10:42??blog_try\blog_try\blog_try.rc
?????文件???????4813??2013-05-13?10:42??blog_try\blog_try\blog_try.vcproj
?????文件???????1423??2013-05-13?14:13??blog_try\blog_try\blog_try.vcproj.20120612-1003.Administrator.user
?????文件????????663??2013-05-13?13:41??blog_try\blog_try\Debug\blog_try.exe.em
?????文件????????728??2013-05-13?13:41??blog_try\blog_try\Debug\blog_try.exe.em
?????文件????????621??2013-05-13?13:41??blog_try\blog_try\Debug\blog_try.exe.intermediate.manifest
?????文件??????23699??2013-05-13?13:41??blog_try\blog_try\Debug\blog_try.obj
?????文件????9764864??2013-05-13?13:34??blog_try\blog_try\Debug\blog_try.pch
?????文件??????48272??2013-05-13?13:41??blog_try\blog_try\Debug\blog_try.res
?????文件??????11438??2013-05-13?13:41??blog_try\blog_try\Debug\BuildLog.htm
?????文件?????????67??2013-05-13?13:41??blog_try\blog_try\Debug\mt.dep
?????文件?????191271??2013-05-13?13:34??blog_try\blog_try\Debug\stdafx.obj
?????文件?????470016??2013-05-13?13:41??blog_try\blog_try\Debug\vc90.idb
?????文件?????790528??2013-05-13?13:41??blog_try\blog_try\Debug\vc90.pdb
?????文件?????443588??2013-05-13?10:36??blog_try\blog_try\DuiLib.lib
?????文件?????446180??2013-05-13?10:36??blog_try\blog_try\DuiLib_d.lib
?????文件?????447372??2013-05-13?10:36??blog_try\blog_try\DuiLib_u.lib
?????文件?????448600??2013-05-13?10:36??blog_try\blog_try\DuiLib_ud.lib
?????文件???????1959??2013-05-13?10:42??blog_try\blog_try\ReadMe.txt
?????文件????????724??2013-05-13?10:42??blog_try\blog_try\Resource.h
????.......?????23558??2003-07-24?09:52??blog_try\blog_try\small.ico
?????文件????????213??2013-05-13?10:42??blog_try\blog_try\stdafx.cpp
?????文件????????749??2013-05-13?13:31??blog_try\blog_try\stdafx.h
?????文件???????1026??2013-05-13?10:42??blog_try\blog_try\targetver.h
?????文件???????1795??2011-05-31?21:42??blog_try\blog_try\UIActiveX.h
?????文件???????8544??2011-06-04?10:51??blog_try\blog_try\UIba
?????文件???????3697??2011-07-27?09:24??blog_try\blog_try\UICombo.h
............此處省略41個文件信息
評論
共有 條評論