摘要: 1 BOOL IsValidEmail( const CString& email ) 2 { 3 int pos = 0; 4 int countAt = 0; 5 int posAt = 0; 6 int posPoint = 0; 7 for(;pos<email.GetLength();pos++){ 8 if(::isspace(email[pos])){ 9 return FALSE;10 }11 if(_T('@') == email[pos]){12 ... 阅读全文
posted @ 2013-10-24 13:10 ssp1024 阅读(411) 评论(0) 推荐(0) 编辑
摘要: 1 BOOL KFunction::HttpPostData( LPCTSTR strUrl,LPCTSTR strData ) 2 { 3 OutputDebugString(_T("URL:")); 4 OutputDebugString(strUrl); 5 OutputDebugString(_T("DATA:")); 6 OutputDebugString(strData); 7 bool bRtn = true; 8 HINTERNET hSession = NULL; 9 HINTERNET hConn = NULL;10... 阅读全文
posted @ 2013-10-23 20:46 ssp1024 阅读(3250) 评论(0) 推荐(0) 编辑
摘要: 1 int URLEncode( const CString& rawStr,CString& encodeStr ) 2 { 3 #ifdef _UNICODE 4 std::string strPre = wstring2string((LPCTSTR)rawStr).c_str(); 5 std::string strEncoded; 6 char* szHexTable = "0123456789ABCDEF", 7 * szUnsafeTable = "\"%\\^[]`+$,@:;/!#?=&" ; 8 fo 阅读全文
posted @ 2013-10-23 20:43 ssp1024 阅读(635) 评论(0) 推荐(0) 编辑
摘要: 1 bool GetMD5(LPCTSTR lpsz,const int strLen,LPTSTR lpMD5,const int bufLen) 2 { 3 memset(lpMD5,0,bufLen); 4 5 int mbStrLen = WideCharToMultiByte(CP_UTF8,0,lpsz,strLen,NULL,0,NULL,NULL); 6 CHAR* mbStr = new CHAR[mbStrLen+1]; 7 memset(mbStr,0,mbStrLen+1); 8 WideCharToMultiByte(CP_... 阅读全文
posted @ 2013-10-23 20:37 ssp1024 阅读(1087) 评论(0) 推荐(0) 编辑
摘要: 1 std::string wstring2string(const std::wstring& wstr) 2 { 3 int bufLen = WideCharToMultiByte(CP_UTF8,0,wstr.c_str(),-1,NULL,0,NULL,NULL); 4 char* strbuf = new char[bufLen]; 5 WideCharToMultiByte(CP_UTF8,0,wstr.c_str(),-1,strbuf,bufLen,NULL,NULL); 6 std::string temp(strbuf); 7 d... 阅读全文
posted @ 2013-10-23 20:25 ssp1024 阅读(1501) 评论(0) 推荐(0) 编辑
摘要: 卸载程序不仅仅把其他软件相关文件和记录删掉,难点在于怎样将自己删除,网上也有很多关于自删除的文章,不错这里有个更简单的方法。 1.程序启动时检查命令行参数,如果为空则将当前执行程序复制的用户临时目录下,并记住该路径。 2.用以特定命令行参数启动临时目录下的执行程序,自身退出,注意在这个过程中不会有任何界面。 3.临时目录下的执行程序开始执行,这次检查到命令行含有制定的参数(上一步传过来的),开始执行卸载,这样就可以直接将软件安装目录下的所有文件全删掉了。 阅读全文
posted @ 2013-10-23 20:22 ssp1024 阅读(929) 评论(0) 推荐(0) 编辑
摘要: http://www.codeguru.com/cpp/cpp/cpp_mfc/stl/article.php/c4143/Working-with-the-Final-Class-in-C.htm 阅读全文
posted @ 2013-10-20 21:02 ssp1024 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 今天使用第三方库,生成目标代码是提示【已经在 MSVCRTD.lib(MSVCR100D.dll) 中定义】,多以碰到这个问题,但是懒得记录下来,今天忽然又碰到竟不知怎么办了。网上搜一下答案:链接器->输入->忽略特定库: libcmt.lib。不过这个显然不符合我们的审美标准,有警告仅简单忽略不是解决问题的方法。忽然想到项目属性中的代码生成中的运行库把这里和用到的第三方库改成一致的就行了。完美解决! 阅读全文
posted @ 2013-10-18 18:13 ssp1024 阅读(3884) 评论(0) 推荐(1) 编辑
摘要: 困扰了一周的问题竟然是这个原因:在 TrackPopoMenu 调用之前调用 SetForegroundWindow 。参考:http://www.slyar.com/blog/tray-menu-exit.html 阅读全文
posted @ 2013-10-13 10:17 ssp1024 阅读(280) 评论(0) 推荐(0) 编辑
摘要: Vista以上版本系统增加了UAC,这就使得很多事情需要管理员权限。今天遇到了个问题,使用regsvr32 注册 MS XML Parse 库。我的系统环境是WIN7 64Bit。现在要注册window\system32目录下的msxml.dll,刚开始我是用普通方式打开命令行,输入regsvr32 msxml6.xml,注册成功注意红线区域显示了当前不是管理员身份。然后又注册msxml4.xml,注册失败,错误代码为:0x80070005纠结了好一会,试着用管理员身份打开命令行,重新注册,这次竟然成功了:红线标注了当前身份是管理员。对于msxml4.dll和msxml6.xml连个文件,还真 阅读全文
posted @ 2013-10-12 08:20 ssp1024 阅读(1101) 评论(0) 推荐(0) 编辑