2011年11月10日

MFC中自定义消息的一般流程

摘要: 1. 定义自己的消息值。一般形式为#define WM_MYMESSAGE (WM_USER + 100) 2. 定义该消息的响应函数。形式应该为:LRESULT CYourClass::OnMyMessage(WPARAM wParam, LPARAM lParam){}其中完成自己想要完成的功能。3. 将两者绑定起来。BEGIN_MESSAGE 与 END_MESSAGE 宏之间,加入:BEGIN_MESSAGE_MAP(CMainFrame, CBCGPMDIFrameWnd).....ON_MESSAGE(WM_MYMESSAGE, OnMyMessage)....END_MESSA. 阅读全文

posted @ 2011-11-10 18:05 LateStop 阅读(392) 评论(0) 推荐(0)

StdioFile类读取中文乱码的问题

摘要: CStdioFile f1; if( !f1.Open( filePath, CFile::modeReadWrite) ) { #ifdef _DEBUG afxDump << "Unable to open file" << "\n"; #endif exit( 1 ); } //设定中文环境 char* old_locale=_strdup( setlocale(LC_CTYPE,NULL) ); setlocale( LC_CTYPE,"chs"); //-----------------读取内容--- 阅读全文

posted @ 2011-11-10 17:46 LateStop 阅读(936) 评论(0) 推荐(0)

VIM高亮无后缀名的文件

摘要: VIM语法高亮是依据文件类型来判断的,如果在编辑txt或者编辑一个根本没有后缀名的的文件,如何加入一点色彩呢?set filetype=c 让目前编辑的文件以C的色彩方式来显现。 阅读全文

posted @ 2011-11-10 17:44 LateStop 阅读(813) 评论(0) 推荐(0)

CTime COleTime与CString的转换

摘要: 一.时间作为特定的数据类型,转换为CString,代码如下:CString strTime;extern COleTime time1;strTime = time1.Format(_T("%Y-%m-%d %H:%M:%S")) 关于字符串"%Y-%m-%d %H:%M:%S"的说明: 1. 在MSDN对strftime()函数的说明里,详细解释了各字母代表的含义:a. %Y Year with century, as decimal number b. %m Month as decimal number (01 – 12) c. %d Day of 阅读全文

posted @ 2011-11-10 17:29 LateStop 阅读(875) 评论(0) 推荐(0)

COleTime 与 DATE 数据类型的理解

摘要: COleTime的存在是因为:It provides finer granularity(更细的颗粒度) and a greater range thanthe CTime class. 之所能做到上述是因为:the DATE date type, and also the COleDateTime class, representdates and times as a classic number line. 这里提到了DATE类型:The DATE type is implemented using an 8-byte floating-point number.Days are r.. 阅读全文

posted @ 2011-11-10 17:03 LateStop 阅读(328) 评论(0) 推荐(0)

导航