VC中如何關(guān)閉窗口退出程序? 收藏
1、OnOK()或OnCancel()//只對窗口程序有用
2、PostQuitMessage(0);//最常用
3、ExitProcess(0);
4、
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);
}
}
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請
點(diǎn)擊舉報。