本文整理汇总了C++中CSysString::Empty方法的典型用法代码示例。如果您正苦于以下问题:C++ CSysString::Empty方法的具体用法?C++ CSysString::Empty怎么用?C++ CSysString::Empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSysString
的用法示例。
在下文中一共展示了CSysString::Empty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MyGetLogicalDriveStrings
bool MyGetLogicalDriveStrings(CSysStringVector &driveStrings)
{
driveStrings.Clear();
UINT32 size = GetLogicalDriveStrings(0, NULL);
if (size == 0)
return false;
CSysString buffer;
UINT32 newSize = GetLogicalDriveStrings(size, buffer.GetBuffer(size));
if (newSize == 0)
return false;
if (newSize > size)
return false;
CSysString string;
for (UINT32 i = 0; i < newSize; i++)
{
TCHAR c = buffer[i];
if (c == TEXT('\0'))
{
driveStrings.Add(string);
string.Empty();
}
else
string += c;
}
if (!string.IsEmpty())
return false;
return true;
}
示例2: SetComplexString
static void SetComplexString(bool &defined, CSysString &destString, LPCTSTR srsString)
{
defined = (srsString != 0);
if (defined)
destString = srsString;
else
destString.Empty();
}
示例3: GetLBText
LRESULT CComboBox::GetLBText(int index, CSysString &s)
{
s.Empty();
LRESULT len = GetLBTextLen(index);
if (len == CB_ERR)
return len;
len = GetLBText(index, s.GetBuffer((int)len + 1));
s.ReleaseBuffer();
return len;
}
示例4: QueryValue
LONG CKey::QueryValue(LPCTSTR name, CSysString &value)
{
value.Empty();
DWORD type = 0;
UInt32 currentSize = 0;
LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, NULL, (DWORD *)¤tSize);
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
return res;
res = QueryValue(name, value.GetBuffer(currentSize), currentSize);
value.ReleaseBuffer();
return res;
}
示例5: MyGetModuleFileName
bool MyGetModuleFileName(HMODULE hModule, CSysString &result)
{
result.Empty();
TCHAR fullPath[MAX_PATH + 2];
DWORD size = ::GetModuleFileName(hModule, fullPath, MAX_PATH + 1);
if (size <= MAX_PATH && size != 0)
{
result = fullPath;
return true;
}
return false;
}
示例6: MyGetDateFormat
bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
LPCTSTR format, CSysString &resultString)
{
resultString.Empty();
int numChars = ::GetDateFormat(locale, flags, time, format, NULL, 0);
if(numChars == 0)
return false;
numChars = ::GetDateFormat(locale, flags, time, format,
resultString.GetBuffer(numChars), numChars + 1);
resultString.ReleaseBuffer();
return (numChars != 0);
}
示例7: GetText
bool CWindow::GetText(CSysString &s)
{
s.Empty();
int length = GetTextLength();
if (length == 0)
return (::GetLastError() == ERROR_SUCCESS);
length = GetText(s.GetBuffer(length), length + 1);
s.ReleaseBuffer();
if (length == 0)
return (::GetLastError() != ERROR_SUCCESS);
return true;
}
示例8: GetLBText
LRESULT CComboBox::GetLBText(int index, CSysString &s)
{
s.Empty();
LRESULT len = GetLBTextLen(index); // length, excluding the terminating null character
if (len == CB_ERR)
return len;
LRESULT len2 = GetLBText(index, s.GetBuf((unsigned)len));
if (len2 == CB_ERR)
return len;
if (len > len2)
len = len2;
s.ReleaseBuf_CalcLen((unsigned)len);
return len;
}