做一个VC程序,在点关闭后,延时3秒关,代码有问题,怎么改?
来源:百度知道 编辑:UC知道 时间:2024/06/08 05:19:41
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
MessageBox("收到WM_Close消息!","提示信息",MB_OK);
SetTimer(1,3000,NULL);
时间响应函数
void CMainFrame::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
KillTimer(1);
CFrameWnd::OnClose();
CFrameWnd::OnTimer(nIDEvent);
}
可以延时,但关闭后出现问题,为什么?如何改?
{
// TODO: Add your message handler code here and/or call default
MessageBox("收到WM_Close消息!","提示信息",MB_OK);
SetTimer(1,3000,NULL);
时间响应函数
void CMainFrame::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
KillTimer(1);
CFrameWnd::OnClose();
CFrameWnd::OnTimer(nIDEvent);
}
可以延时,但关闭后出现问题,为什么?如何改?
void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
MessageBox("收到WM_Close消息!","提示信息",MB_OK);
//SetTimer(1,3000,NULL);
//误解SetTimer了.直接“休眠”3秒即可。
Sleep(3000);//至少,Sleep的精度和Timer一样
TODO: Add your message handler code here and/or call default
KillTimer(1);
CFrameWnd::OnClose();
CFrameWnd::OnTimer