我将对话框变成非模态的对话框,并把对话框隐藏,没有确定和退出,我怎么关闭它呢?
也就是DestroyWindow()应该加在哪里呢?
我想让这个程序已运行就关闭,中间实现其他的功能。

解决方案 »

  1.   

    中间实现其他的功能。
    实现之后,调用Destroy...
      

  2.   

    你可以这样做:
    在OnInitDialog函数里做你想要实现的功能,实现完成后设置一个定时器,在定时器里调用DestroyWindow()代码:
    BOOL CTestDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();
    //自动生成的代码省略这里不写出
    SetTimer(1,1000,NULL);
    return TRUE;  // return TRUE  unless you set the focus to a control
    }重载OnTimer函数
    void CTestDlg::OnTimer(UINT nIDEvent) 
    {
    // TODO: Add your message handler code here and/or call default
    if(nIDEvent==1)
    DestroyWindow();
    CDialog::OnTimer(nIDEvent);
    }
    //以上代码在vc6测试通过