您的位置:首页 > 其它

VC中如何关闭窗口退出程序

2009-08-14 16:35 281 查看
1.OnCancel();或OnOK();//只对窗口程序有用

2.PostQuitMessage(0);

3.ExitProcess(0);

4.exit(1);

5.SendMessage(WM_CLOSE);

6.DestroyWindow();

7.void CMainFrame::OnClose()
{
// TODO: Add your message handler code here and/or call default
if (MessageBox("确定要退出吗?","提示",MB_YESNO|MB_DEFBUTTON2)==IDYES)
{
CFrameWnd::OnClose();
}
}


如:

void CCsView::OnShutdown() //自定义
{
// TODO: Add your command handler code here
if (MessageBox("确定要退出吗?","提示",MB_YESNO|MB_DEFBUTTON2)==IDYES)
{
PostQuitMessage(0);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: