示例#1
0
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;
}
示例#2
0
bool MyGetVolumeInformation(
    LPCTSTR rootPathName,
    CSysString &volumeName,
    LPDWORD volumeSerialNumber,
    LPDWORD maximumComponentLength,
    LPDWORD fileSystemFlags,
    CSysString &fileSystemName)
{
  bool result = BOOLToBool(GetVolumeInformation(
      rootPathName,
      volumeName.GetBuffer(MAX_PATH), MAX_PATH,
      volumeSerialNumber,
      maximumComponentLength,
      fileSystemFlags,
      fileSystemName.GetBuffer(MAX_PATH), MAX_PATH));
  volumeName.ReleaseBuffer();
  fileSystemName.ReleaseBuffer();
  return result;
}
示例#3
0
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 *)&currentSize);
  if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
    return res;
  res = QueryValue(name, value.GetBuffer(currentSize), currentSize);
  value.ReleaseBuffer();
  return res;
}
示例#4
0
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);
}
示例#5
0
文件: Window.cpp 项目: BIAINC/7Zip
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;
}
示例#6
0
CSysString MyLoadString(HINSTANCE hInstance, UINT resourceID)
{
  CSysString s;
  int size = 256;
  int len;
  do
  {
    size += 256;
    len = ::LoadString(hInstance, resourceID, s.GetBuffer(size - 1), size);
  }
  while (size - len <= 1);
  s.ReleaseBuffer();
  return s;
}
示例#7
0
LONG CKey::EnumKeys(CSysStringVector &keyNames)
{
  keyNames.Clear();
  CSysString keyName;
  for (UInt32 index = 0; ; index++)
  {
    const UInt32 kBufferSize = MAX_PATH + 1; // 256 in ATL
    FILETIME lastWriteTime;
    UInt32 nameSize = kBufferSize;
    LONG result = ::RegEnumKeyEx(_object, index, keyName.GetBuffer(kBufferSize),
        (DWORD *)&nameSize, NULL, NULL, NULL, &lastWriteTime);
    keyName.ReleaseBuffer();
    if (result == ERROR_NO_MORE_ITEMS)
      break;
    if (result != ERROR_SUCCESS)
      return result;
    keyNames.Add(keyName);
  }
  return ERROR_SUCCESS;
}
示例#8
0
文件: Shell.cpp 项目: Ando02/wubiuefi
bool GetPathFromIDList(LPCITEMIDLIST itemIDList, CSysString &path)
{
  bool result = BOOLToBool(::SHGetPathFromIDList(itemIDList, path.GetBuffer(MAX_PATH * 2)));
  path.ReleaseBuffer();
  return result;
}