65,211
社区成员
发帖
与我相关
我的任务
分享
CMsgBox::CMsgBox()
{
}
CMsgBox::~CMsgBox()
{
}
void CMsgBox::MessageBox(CString sMsg, CString sCaption, UINT nSleep, UINT nFlags, bool bAutoClose)
{
m_sCaption=sCaption;
if(bAutoClose)
{
CWnd::SetTimer(100,nSleep,NULL);
CWnd::MessageBox(sMsg,sCaption,nFlags);
}
}
void CMsgBox::OnTimer(UINT nIDEvent)
{
bool bRet=false;
CWnd* pWnd = FindWindow(NULL, m_sCaption);
if(pWnd!=NULL)
{
::PostMessage(pWnd->m_hWnd, WM_CLOSE, 0, 0);
}
KillTimer(100);
CWnd::OnTimer(nIDEvent);
}
CMsgBox cmsg;
cmsg.SetParent(this);//这句会出错