··如何让弹出的对话框自动消失

··怎么让弹出的对话框自动消失?
一般都是通过点关闭按钮来让对话框消失,
想在程序中控制在满足一定条件后,对话框自动消失。

------解决方案--------------------
BOOL Wancheng::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: 在此添加额外的初始化
SetTimer(1,1000,NULL);

return TRUE; // return TRUE unless you set the focus to a control
// 异常:OCX 属性页应返回 FALSE
}

void Wancheng::OnTimer(UINT nIDEvent)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
if (nIDEvent==1)
{
OnCancel();
}

CDialog::OnTimer(nIDEvent);
}