上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页
摘要: 在应用程序类中加入如下代码:BOOL CClientApp::InitInstance(){ if (!ProcessShellCommand(cmdInfo)) return FALSE; m_pMainWnd->SetWindowTextW( _T( "窗口标题" ) );}注意:SetWindowText必须在ProcessShellCommand创建文档之后使用,否则会运行错误。可直接将设置窗口标题的代码加到InitInstance的尾部。 阅读全文
posted @ 2009-07-20 20:54 冷寒生 阅读(1559) 评论(0) 推荐(0) 编辑
摘要: BOOL CTestView::OnEraseBkgnd(CDC* pDC){ // TODO: 在此添加消息处理程序代码和/或调用默认值 /* 视图背景颜色 */ CRect rect; CBrush brush; brush.CreateSolidBrush( RGB( 242, 240, 239 ) ); pDC->GetClipBox(rect); pDC->FillRect(rect,&brush); return true; return CView::OnEraseBkgnd(pDC);} 阅读全文
posted @ 2009-07-15 18:52 冷寒生 阅读(173) 评论(0) 推荐(0) 编辑
摘要: /* 窗口样式参考列表:WS_POPUP - 弹出式窗口(不能与WS_CHILDWINDOW样式同时使用)WS_CHILDWINDOW - 子窗口(不能与WS_POPUP合用)WS_MINIMIZE - 最小化状态WS_VISIBLE - 可见状态WS_DISABLED - 不可用状态WS_CLIPSIBLINGS - 使窗口排除子窗口之间的相对区域WS_CLIPCHILDREN - 当在父窗口内绘图时,排除子窗口区域WS_MAXIMIZE - 具有最大化按钮,须指定WS_SYSTEM样式WS_CAPTION - 有标题框和边框(和WS_TILED样式相同)WS_BORDER - 有单边框WS 阅读全文
posted @ 2009-07-15 17:53 冷寒生 阅读(1312) 评论(0) 推荐(0) 编辑
摘要: 来自:梦在天涯C++博客(http://www.cppblog.com/mzty/)一 线程1)如果你正在编写C/C++代码,决不应该调用CreateThread。相反,应该使用VisualC++运行期库函数_beginthreadex,退出也应该使用_endthreadex。如果不使用Microsoft的VisualC++编译器,你的编译器供应商有它自己的CreateThred替代函数。不管这个替代函数是什么,你都必须使用。2)因为_beginthreadex和_endthreadex是CRT线程函数,所以必须注意编译选项runtimelibaray的选择,使用MT或MTD。3)_begin 阅读全文
posted @ 2009-07-14 02:08 冷寒生 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 最近一个转换文件的程序,在转换大批量文件是老是 stack overflow。查来查去。。原来是 在大循环中用了W2A和A2W两个宏。MSDN的 TN059: Using MFC MBCS/Unicode Conversion Macros 有描述,这两个宏在大循环中要有特殊的写法,不然保不准就 stack overflow。Other ConsiderationsDo not use the macros in a tight loop. For example, you do not want to write the following kind of code:Copy Codevoi 阅读全文
posted @ 2009-07-10 10:30 冷寒生 阅读(882) 评论(0) 推荐(0) 编辑
摘要: 在C/C++中没有专门的正则库,所有只好使用第三方库,我首先选择的是boost的regex。虽说boost的regex类比较复杂,但在这之前我也用过,没出过问题。但这次却因一个小小的疏忽折腾了我两天。程序的功能是从文件中读取字符串,接着从数据库读取正则表达式,却发现有几个正则表达式无法匹配,但用这些正则表达式到正则测试工具中又能够匹配。首先我怀疑boost的中文匹配功能,所以将读取的字符串转换为了宽字符,但仍然无法匹配。接着我怀疑是我使用boost的方法不对,因为在用boost进行简单测试时,又百分百能够匹配。在boost的问题上折腾了一天,仍然找不到原因。于是下了个deelx,这个正则库只有 阅读全文
posted @ 2009-07-09 20:59 冷寒生 阅读(237) 评论(0) 推荐(0) 编辑
摘要: CString转std::wstringstd::wstring str = filename.GetString();std::wstring转CStringCString str( filename.c_str() ); 阅读全文
posted @ 2009-07-09 09:32 冷寒生 阅读(975) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>#include <boost/regex.hpp>#include <string>using namespace std;using namespace boost;/*搜索字符串中是否含有子字符串int main( int argc, char* argv[] ){ char *buf = "This is boost::regex example boost::regex"; boost::regex exampleregex( "boost::regex" ); boos 阅读全文
posted @ 2009-07-05 18:46 冷寒生 阅读(296) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include <cstdlib>#include <stdlib.h>#include <boost/regex.hpp>#include <string>#include <iostream>using namespace std;using namespace boost;regex expression("^select ([a-zA-Z]*) from ([a-zA-Z]*)");int main(int argc, char* argv[]){ 阅读全文
posted @ 2009-07-05 15:12 冷寒生 阅读(153) 评论(0) 推荐(0) 编辑
摘要: #include "stdafx.h"#include <cstdlib>#include <stdlib.h>#include <boost/regex.hpp>#include <string>#include <iostream>using namespace std;using namespace boost;regex reg("a(\\d*)b");int main(int argc, char* argv[]){ string in; cmatch what; cout <& 阅读全文
posted @ 2009-07-05 15:09 冷寒生 阅读(565) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 14 下一页
IT知识库