随笔分类 -  常用函数

摘要:需要删除一个为注册为com组件的dll,反注册过程神马的都已经写好了。现在需要在删除之前确定组件是否是好的。ProgId,dll名称以及ClsId都是知道的。首先,在网上查找相关资料,有两种方式:1)通过查找注册表,因为所有的com组件都注册在HKEY_CLASS_ROOT下面,通过查看注册该组件的键值是否存在来判断。2)通过CoCreateInstance函数来创建这个com组件的对象,创建成功说明正常。在此选择第二种方式。因为第一种仅仅判断了该com组件注册过而且注册信息还保留着,文件是否仍然存在、键值是否损坏没有考虑。判断的过程很顺利,不过删除出现了问题,发现dll文件可以正常删除,可以 阅读全文
posted @ 2013-11-04 20:36 ssp1024 阅读(509) 评论(0) 推荐(0)
摘要: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 阅读(436) 评论(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 阅读(3379) 评论(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 阅读(642) 评论(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 阅读(1102) 评论(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 阅读(1616) 评论(0) 推荐(0)