本文整理汇总了C++中atl::CString::GetLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::GetLength方法的具体用法?C++ CString::GetLength怎么用?C++ CString::GetLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atl::CString
的用法示例。
在下文中一共展示了CString::GetLength方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WSCoCreateDotNetInstancePtr
IUnknownPtr GenericCLRLoader::WSCoCreateDotNetInstancePtr(const CLSID& clsid)
{
LPOLESTR szClsid;
HRESULT hr = StringFromCLSID(clsid, &szClsid);
if (FAILED(hr))
throw _com_error(hr);
ATL::CString sClsid = szClsid;
CoTaskMemFree(szClsid);
CRegKey rkCLSID;
hr = rkCLSID.Open(HKEY_CLASSES_ROOT, L"CLSID\\" + sClsid + L"\\InprocServer32", KEY_READ);
if (hr != ERROR_SUCCESS)
throw _com_error(HRESULT_FROM_WIN32(hr));
ATL::CString sAssembly = GetStringValue(rkCLSID, L"Assembly");
ATL::CString sClass = GetStringValue(rkCLSID, L"Class");
ATL::CString sCodeBase = GetStringValue(rkCLSID, L"CodeBase");
if (sAssembly.GetLength() == 0 || sClass.GetLength() == 0 || sCodeBase.GetLength() == 0)
throw _com_error(REGDB_E_CLASSNOTREG);
ATL::CString dllPath;
ATL::CString strFilePrefix(_T("file:///"));
if (sCodeBase.Left(strFilePrefix.GetLength()).MakeLower() == strFilePrefix)
{
dllPath = sCodeBase.Mid(strFilePrefix.GetLength()); // discard 'file:///'
}
else
{
dllPath = sCodeBase;
}
IUnknownPtr result;
hr = TheInstance()->CreateCOMObject(dllPath, sAssembly, sClass, &result);
if (FAILED(hr))
throw _com_error(hr);
return result;
}
示例2: HasChineseChar
//----------------------------------------------
//modified by robet.li
BOOL HasChineseChar(const ATL::CString &destStr)
{
BOOL bHasChinsesChar = FALSE;
int nLen = destStr.GetLength();
unsigned char c1,c2;
BOOL bFirstSpace = TRUE;
for(int i=0; i<nLen; i++)
{
c1 = destStr[i];
if((i+1) >= nLen)
{
if (bFirstSpace && (c1 == ' ' || c1 == '\t'))
{
}
else
{
//strConv += destStr[i];
bFirstSpace = FALSE;
}
break;
}
else
{
c2 = destStr[i+1];
if(c1 == 163) //ÅжÏÊÇ·ñΪȫ½Ç×Ö·û
{
//strConv += TCHAR(c2-128);
i++;
bFirstSpace = FALSE;
}
else if((int)c1 > 163) //ÅжÏÊÇ·ñΪÎÄ×Ö
{
//strConv += (TCHAR)c1;
//strConv += (TCHAR)c2;
i++;
bFirstSpace = FALSE;
bHasChinsesChar = TRUE;
break;
}
else if((c1 == 161) && (c2 == 161)) //ȫΪ¿Õ¸ñ
{
i++;
}
else //Èç¹ûÊÇ°ë½Ç×Ö·û
{
if (bFirstSpace && (c1 == ' ' || c1 == '\t'))
{
}
else
{
//strConv += (TCHAR)c1;
bFirstSpace = FALSE;
}
}//endi
}
}
return bHasChinsesChar;
}
示例3: MakeFilterString
inline void MakeFilterString(ATL::CString& str)
{
char *pch = str.GetBuffer();
for(int i = 0; i < str.GetLength(); ++i)
if(pch[i] == '|') pch[i] = '\0';
}