mainwindow.h

class MainWndFrame : public WindowImplBase
{
	//这个是比较关键的一句话
	DUI_DECLARE_MESSAGE_MAP()

proteced:
	virtual CDuiString GetSkinFolder() override;							// 获取皮肤文件的目录,如果有多层目录这里可以设置
	virtual CDuiString GetSkinFile() override;								// 设置皮肤文件名字
	virtual LPCTSTR GetWindowClassName(void) const override;				// 设置当前窗口的 class name
	virtual void InitWindow() override;
	virtual void OnClick(TNotifyUI& msg);

	void OnKillFous(TNotifyUI& msg);
	void OnSetFous(TNotifyUI& msg);
private:
	CEditUI* m_pEdit {nullptr};
}

mainwindows.cpp

//信号列表,当有对应消息时,对应的函数会被调用
//需要现在类声明出添加 DUI_DECLARE_MESSAGE_MAP()
DUI_BEGIN_MESSAGE_MAP(MainWndFrame, CNotifyPump)
DUI_ON_MSGTYPE(DUI_MSGTYPE_CLICK, OnClick)
DUI_ON_MSGTYPE(DUI_MSGTYPE_SETFOCUS, OnSetFous)
DUI_ON_MSGTYPE(DUI_MSGTYPE_KILLFOCUS, OnKillFous)
DUI_END_MESSAGE_MAP()

//用户展示的提示
#define DEFAULT_HINT_TEXT L"Hint text test"

void MainWndFrame::InitWindow()
{
m_pEdit = dynamic_cast<CEditUI*>(m_PaintManager.FindControl(_T("edit_name")));
}

void MainWndFrame::OnClick(TNotifyUI& msg)
{}

void MainWndFrame::OnKillFous(TNotifyUI& msg)
{
	CDuiString sCtrlName = msg.pSender->GetName();
	if(sCtrlName != L"edit_name")return;
	if(m_pEdit->m_pEditAddress->GetText().Empty()
	|| 0 == m_pEdit->m_pEditAddress->GetText().Compare(DEFAULT_HINT_TEXT ))
	{
		m_pEdit->SetText(DEFAULT_HINT_TEXT);
		m_pEdit->SetTextColor(0xFFD9D9D9);
	}
}

void MainWndFrame::OnSetFous(TNotifyUI& msg)
{
	CDuiString sCtrlName = msg.pSender->GetName();
	if(sCtrlName != L"edit_name")return;	
	m_pEdit->SetTextColor(0xFF000000);
	if(0 == m_pEdit->m_pEditAddress->GetText().Compare(DEFAULT_HINT_TEXT ))
	{
		m_pEditAddress->SetText(L"");
	}
}

Q.E.D.