⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index004.htm

📁 一本不错的VC编程的参考书
💻 HTM
字号:
<html>
<style type="text/css"><!--
.p9 {  font-family: "宋体"; font-size: 9pt}a        {text-transform: none; text-decoration: none;}
a:hover {text-decoration: underline; color: #FF0000;}
--></style>
<body background="../di2001.jpg">
<h3 align="center"><font COLOR="#AOAO99"></font></h3>
<table width="100%" border="1" cellspacing="1">
<tr><td><p align="center"><font color="#FF0000">如何编程结束应用程序?</font></td></tr>
<tr><td><p>
</Br>
这是个很简单又是编程中经常要遇到的问题.<Br>
向窗口发送 WM_CLOSE消息,调用 CWnd::OnClose成员函数.允许对用户提示是否保存修改过的数据.<Br>
&nbsp;Example: AfxGetMainWindow()->SendMessage(WM_CLOSE)<Br>
</Br>
还可以创建一个自定义的函数 Terminate Window<Br>
&nbsp;void Terminate Window(LPCSTR pCaption)<Br>
&nbsp;{<Br>
&nbsp;CWnd *pWnd=Cwnd::FindWindow(NULL,pCaption)<Br>
</Br>
if (pWnd)<Br>
</Br>
pWnd ->SendMessage(WM_CLOSE)<Br>
&nbsp;}<Br>
</Br>
&nbsp;&nbsp;&nbsp;&nbsp;说明: FindWindow函数不是提倡的做法,因为它无法处理标题栏自动改变,比如我们要检测 Notepad是不是已运行而事先不知道Notepad的标题栏,这时FindWindow就无能为力了,可以通过枚举 windows任务列表的办法来实现。在机械出版社"Windows 95 API开发人员指南"一书有比较详细的介绍,这里就不再多说乐。<Br>
</Br>
</Br>
</p></td></tr>
</table>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -