编码实现修改应用程序标题
来源:互联网 发布:软件开发专业就业方向 编辑:程序博客网 时间:2024/06/16 05:49
1.问题背景
使用afxmessagebox弹出信息框,此函数没有设置标题的参数,默认标题为创建的项目名称。
注:因使用的环境不允许使用messagebox.so....寻找之路。。。
2.初识 m_pszAppName
MSDN: The application name can come from the parameter passed to the CWinApp constructor, or, if not specified, to the resource string with the ID ofAFX_IDS_APP_TITLE. If the application name is not found in the resource, it comes from the program's .EXE filename.
根据MSDN的描述,我们只要改掉这个值就可以了,如何修改。
3.实践操作
我想实现在CDlg_Test.cpp中所有的标题都设为“网络安全”。
a)构造函数时修改
//First free the string allocated by MFC at CWinApp startup.
//The string is allocated before InitInstance is called.
free((void*)AfxGetApp()->m_pszAppName);
//Change the name of the application file.
//The CWinApp destructor will free the memory.
AfxGetApp()->m_pszAppName = _tcsdup("网络安全");
ps:此时使用afxmessage(),标题就变为改之后的。
b)重写DoMessageBox--此种方式笔者没有亲自实验:)
int CEx0811aApp::DoMessageBox(LPCTSTR lpszPrompt, UINT nType, UINT nIDPrompt)
{
LPCTSTR pOldAppName = m_pszAppName;
m_pszAppName = "新标题";// 其实afxmessgebox的标题就是这个变量决定的
int iRet = CWinApp::DoMessageBox(lpszPrompt, nType, nIDPrompt);
m_pszAppName = pOldAppName ;
return iRet ;
}
- 编码实现修改应用程序标题
- 修改MFC应用程序的标题
- 如何修改单文档应用程序的标题
- 实现修改iOS应用程序名
- 怎样修改MFC中应用程序标题的图标?
- MFC中修改应用程序主窗口的标题
- VC下修改单文档应用程序的标题
- eclipse、MyEclipse实现批量修改文件编码
- javascript实现修改微信分享的标题内容等
- 编码修改
- 修改 编码
- 修改Dialog的标题
- 修改UI的标题
- 修改母版页标题
- ListView-修改标题列
- DataGridView如何修改标题
- 修改IE标题
- 修改 AFXMessageBox标题
- 算法的特征及设计要求
- MySQL常用命令(持续总结中)
- sum 3- 4
- 算法基础-动态规划 (1) 01背包问题
- linux系统下安装jdk
- 编码实现修改应用程序标题
- UVA - 110 Meta-Loopless Sorts(元排序 回溯)
- 删除最后一次的备份文件vbs
- oracle 创建临时表空间、用户表空间、创建用户关联表空间、授权等总结
- SpringMVC接受返回JSON数组
- ubuntu 12.04下LAMP安装配置
- nodejs快捷升级方式
- 3、找出单链表的中间元素
- tapestry注释介绍Annotations