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);
}
}
本文介绍了在Windows应用程序中关闭窗口的七种不同方法,包括使用OnCancel()、PostQuitMessage(0)、ExitProcess(0)等,并通过示例代码展示了如何实现这些关闭操作。
3666

被折叠的 条评论
为什么被折叠?



