C++语言 显示欢迎窗体

    CBegin dlg;
    if(dlg.DoModal()!=IDCANCEL)
    {
        OnOK();
    }


BOOL CBegin::OnInitDialog() 
{
    CDialog::OnInitDialog();
    
    // TODO: Add extra initialization here
    SetTimer(1, 2000, NULL); //1:Specifies a nonzero timeridentifier
                             //2000:Specifies the time-out value, in milliseconds.
                             //NULL:Pointer to the function...if it's NULL, the system posts a WM_TIMER message to the application queue.
    
    return TRUE;  // return TRUE unless you set the focus to a control
                  // EXCEPTION: OCX Property Pages should return FALSE
}

void CBegin::OnTimer(UINT nIDEvent) 
{
    // TODO: Add your message handler code here and/or call default
    
    KillTimer(1); //1:the timer identifier
    CDialog::OnCancel();

    CDialog::OnTimer(nIDEvent);
}
学习笔记转摘于: 丝酷网 http://www.pythonschool.com/
原文地址:https://www.cnblogs.com/pythonschool/p/2770025.html