第3章 MFC原理介绍
来源:互联网 发布:mac的软件强制退出不了 编辑:程序博客网 时间:2024/06/06 05:41
1.使用CTime类显示当前时间
<span style="font-size:18px;">void CTmDlg::OnTest() {</span><pre name="code" class="html"><span style="font-size:18px;"> //Creates a <strong>CTime</strong> object that represents the current time (static member function).</span>CTime t = CTime::GetCurrentTime();//static成员无需对象,直接使用类名来调用即可
int nYear = t.GetYear();int nMonth = t.GetMonth();int nDay = t.GetDay();int nHour = t.GetHour();int nMinute = t.GetMinute();int nSecond = t.GetSecond();CString szTime;//格式化组串:将各种类型的数据合并成一个字符串szTime.Format("%d-%d-%d %d:%d:%d",nYear,nMonth,nDay,nHour,nMinute,nSecond);AfxMessageBox(szTime);}
2.WM_COMMAND:wParam记录单击的按钮或者菜单项等ID号码;
WM_LBUTTONDOWN:lParam记录单击界面的(x,y)坐标等;
3. CWnd::SetWindowText
//Sets the window’s title to the specified text. If the window is a control, the text within the control is set.
4.SendMessage等待消息被处理完之后才返回;
PostMessage只把消息放入窗口消息队列中,不管消息被处理后的结果就返回;
5.MFC调用Win32函数时,函数名前经常需要使用空定义域符号“::”,这是C++用于区别全局函数和成员函数的标志。
6.在MFC程序中,必须使用ON_MESSAGE来关联消息映射函数。
0 0
- 第3章 MFC原理介绍
- 【计算机网络原理】第6、第7章简单介绍
- 学习笔记:第3课 MFC框架介绍
- 学习笔记之深入浅出MFC 第6章 Console程序介绍
- MFC消息机制以及其原理简单介绍
- 《深入浅出MFC》第109页,关于Iskindof的介绍
- 《编译原理-龙书》练习第3章
- 数据库原理选择题总结(第3章)
- 《计算机网络原理》之第2、3章
- 第3章 网络设备及其操作系统介绍
- 第1章 介绍
- 第1章介绍
- 第1章 介绍
- MFC原理
- MFC介绍
- 第001讲 html介绍 html运行原理
- 第001讲 html介绍 html运行原理①
- 20160401 第3章 鼠标和键盘(来自《MFC Windows 程序设计(第2版)》)
- linux sort,uniq,cut,wc命令详解
- mac bash shell下的javac命令乱码
- android加载图片优化(三级缓存)
- SWFUpload.js
- DirectX11 获得纹理描述
- 第3章 MFC原理介绍
- phpstorm + xdebug 远程断点调试,详解
- Android入门:通过XML数据与服务器进行通信
- 正则-匹配超链接地址及内容
- Android几行代码实现双击back键退出程序
- 君子务本,本立而道生!
- Windows2008RC2 IIS配置php运行环境
- iOS企业帐号对ipa重新签名流程
- win32 hook相关模式