資源簡介
Duilib來實現的登錄窗口,VS2010開發平臺。
功能不多,只為理解程序與xml。

代碼片段和文件信息
//2012.10.16?????by?l0g1n。
#include?“stdafx.h“
class?CframeWindowWnd:public?CWindowWndpublic?INotifyUI
{
public:
CframeWindowWnd(){};
LPCTSTR?GetWindowClassName()?const?{?return?_T(“UIMainframe“);?}
void?OnPrepare()?
{
}
void?Notify(TNotifyUI&?msg)
{
if(msg.sType==_T(“windowinit“))
OnPrepare();
else?if(msg.sType==_T(“click“))
{
if(msg.pSender==m_pCloseBtn)
{
PostQuitMessage(0);
return;
}else?if(msg.pSender==m_pRegisterBtn)
{
MessageBox(NULLm_pNameEdit->GetText()+_T(“\n“)+m_pPasswdEdit->GetText()_T(“注冊“)MB_OK);
return;
}else?if(msg.pSender==m_pLoginBtn)
{
MessageBox(NULLm_pNameEdit->GetText()+_T(“\n“)+m_pPasswdEdit->GetText()_T(“登錄“)MB_OK);
return;
}
}
}
void?Init()
{
?m_pCloseBtn?=?static_cast(m_pm.FindControl(_T(“closebtn“)));
?m_pRegisterBtn=static_cast(m_pm.FindControl(_T(“registerbtn“)));
?m_pLoginBtn=static_cast(m_pm.FindControl(_T(“loginbtn“)));
?m_pNameEdit=static_cast(m_pm.FindControl(_T(“nameedit“)));
?m_pPasswdEdit=static_cast(m_pm.FindControl(_T(“passwdedit“)));
}
????LRESULT?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);
????????//m_pm.SetTransparent(100);
????????CDialogBuilder?builder;
????????CControlUI*?pRoot?=?builder.Create(_T(“login.xml“)?(UINT)0?NULL?&m_pm);
????????ASSERT(pRoot?&&?“Failed?to?parse?xml“);
????????m_pm.AttachDialog(pRoot);
????????m_pm.AddNotifier(this);
????????Init();
????????return?0;
????}
????LRESULT?OnSize(UINT?uMsg?WPARAM?wParam?LPARAM?lParam?BOOL&?bHandled)
????{
????????SIZE?szRoundCorner?=?m_pm.GetRoundCorner();//這個是圓角,是橢圓的半徑
//這里有個很巧妙的用法,在xml文件中一定要設置圓角(roundcorner),
//不然不會進入下面的if,也就會出現標題欄。
????????if(?!::IsIconic(*this)?&&?(szRoundCorner.cx?!=?0?||?szRoundCorner.cy?!=?0)?)?{
????????????CRect?rcWnd;
????????????::GetWindowRect(*this?&rcWnd);
????????????rcWnd.Offset(-rcWnd.left?-rcWnd.top);
????????????rcWnd.right++;?rcWnd.bottom++;
????????????RECT?rc?=?{?rcWnd.left?rcWnd.top?+?szRoundCorner.cx?rcWnd.right?rcWnd.bottom?};
????????????HRGN?hRgn1?=?::CreateRectRgnIndirect(?&rc?);
????????????HRGN?hRgn2?=?::CreateRoundRectRgn(rcWnd.left?rcWnd.top?rcWnd.right?rcWnd.bottom?-?szRoundCorner.cx?szRoundCorner.cx?szRoundCorner.cy);
????????????::CombineRgn(?hRgn1?hRgn1?hRgn2?RGN_OR?);
????????????::SetWindowRgn(*this?hRgn1?TRUE);
????????????::Deleteobject(hRgn1);
????????????::Deleteobject(hRgn2);
????????}
????????bHandled?=?FALSE;
????????return?0;
????}
????LRESULT?OnGetMinMaxInfo(UINT?uMsg?WPARAM?wParam?LPARAM?lParam?BOOL&?bHandled)
????{
????????MONITORINFO?oMonitor?=?{};
????????oMonitor.cbSize?=?sizeof(oMonitor);
?????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????48640??2012-10-16?21:33??Login\Debug\Login.exe
?????文件??????89467??2012-10-16?16:34??Login\Debug\skin\bk_image.png
?????文件???????2358??2010-01-23?22:10??Login\Debug\skin\fr
?????文件???????2358??2012-10-16?21:18??Login\Debug\skin\fr
?????文件???????2358??2012-10-16?21:17??Login\Debug\skin\fr
?????文件???????1182??2012-10-16?21:30??Login\Debug\skin\login.xm
?????文件????????566??2012-10-16?21:33??Login\Login\Debug\cl.command.1.tlog
?????文件??????15124??2012-10-16?21:33??Login\Login\Debug\CL.read.1.tlog
?????文件????????208??2012-10-16?21:33??Login\Login\Debug\CL.write.1.tlog
?????文件??????????2??2012-10-16?21:33??Login\Login\Debug\li
?????文件??????????2??2012-10-16?21:33??Login\Login\Debug\li
?????文件??????????2??2012-10-16?21:33??Login\Login\Debug\li
?????文件??????????2??2012-10-16?21:33??Login\Login\Debug\li
?????文件??????????2??2012-10-16?21:33??Login\Login\Debug\li
?????文件??????????2??2012-10-16?21:33??Login\Login\Debug\li
?????文件???????1246??2012-10-16?21:33??Login\Login\Debug\li
?????文件???????2502??2012-10-16?21:33??Login\Login\Debug\li
?????文件????????480??2012-10-16?21:33??Login\Login\Debug\li
?????文件????????406??2012-10-16?20:13??Login\Login\Debug\Login.exe.em
?????文件????????472??2012-10-16?20:13??Login\Login\Debug\Login.exe.em
?????文件????????381??2012-10-16?21:33??Login\Login\Debug\Login.exe.intermediate.manifest
?????文件?????????44??2012-10-16?21:33??Login\Login\Debug\Login.lastbuildstate
?????文件???????1986??2012-10-16?21:33??Login\Login\Debug\Login.log
?????文件??????64234??2012-10-16?21:33??Login\Login\Debug\login.obj
?????文件????????200??2012-10-16?19:48??Login\Login\Debug\Login_manifest.rc
?????文件????????328??2012-10-16?21:33??Login\Login\Debug\mt.command.1.tlog
?????文件????????222??2012-10-16?21:33??Login\Login\Debug\mt.read.1.tlog
?????文件????????222??2012-10-16?21:33??Login\Login\Debug\mt.write.1.tlog
?????文件????????420??2012-10-16?20:13??Login\Login\Debug\rc.command.1.tlog
?????文件????????194??2012-10-16?20:13??Login\Login\Debug\rc.read.1.tlog
............此處省略66個文件信息
評論
共有 條評論