本文整理汇总了C++中CAtlString::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlString::GetBuffer方法的具体用法?C++ CAtlString::GetBuffer怎么用?C++ CAtlString::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlString
的用法示例。
在下文中一共展示了CAtlString::GetBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NewCmd
int Runner::NewCmd(LPCTSTR taskname, LPTSTR lpCmdLine)
{
Params::Save(lpCmdLine);
DWORD dwProcessId = ::GetCurrentProcessId();
CHandle hEventRun( ::CreateEvent( NULL, FALSE, TRUE, c_szEventRun));
if (::WaitForSingleObject(hEventRun, c_dwRunTimeout) != WAIT_OBJECT_0)
return ecSimultanius;
CString strEvent;
strEvent.Format(c_szEventExit, dwProcessId);
CHandle hEventExit( ::CreateEvent( NULL, TRUE, FALSE, strEvent));
::ResetEvent( hEventExit);
CAtlString sApp;
sApp.Format(_T("schtasks /run /TN \"%s\""), taskname);
STARTUPINFO startup_info = {0};
startup_info.cb = sizeof( STARTUPINFO );
PROCESS_INFORMATION process_info = {0};
BOOL bStatus = ::CreateProcess( NULL, sApp.GetBuffer(MAX_PATH), NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &startup_info, &process_info );
if ( bStatus == FALSE)
return ecRunTask;
::CloseHandle( process_info.hProcess );
::CloseHandle( process_info.hThread );
if (::WaitForSingleObject(hEventRun, c_dwRunTimeout) != WAIT_OBJECT_0)
return ecUnknown;
::WaitForSingleObject(hEventExit, INFINITE);
return ecNoError;
}
示例2: PopulateCategory
void CTedTransformDialog::PopulateCategory(DMOCategory& category)
{
TVINSERTSTRUCT treeInserter;
treeInserter.hParent = TVI_ROOT;
treeInserter.hInsertAfter = TVI_FIRST;
CAtlString strName = LoadAtlString(category.m_nID);
TVITEM item;
item.mask = TVIF_TEXT;
item.pszText = strName.GetBuffer();
item.cchTextMax = strName.GetLength();
treeInserter.item = item;
HTREEITEM hBaseItem = (HTREEITEM) TreeView_InsertItem(m_hList, &treeInserter);
assert(hBaseItem != NULL);
treeInserter.hParent = hBaseItem;
item.mask = TVIF_TEXT | TVIF_PARAM;
DMO_PARTIAL_MEDIATYPE mediaType;
CComPtr<IEnumDMO> spDMOList;
mediaType.type = GUID_NULL;
mediaType.subtype = GUID_NULL;
IMFActivate** ppActivates = NULL;
UINT32 cMFTs = 0;
::MFTEnumEx(category.m_GUID, MFT_ENUM_FLAG_ALL, NULL, NULL, &ppActivates, &cMFTs);
for(DWORD i = 0; i < cMFTs; i++)
{
m_Activates.Add(ppActivates[i]);
LPWSTR pszName = NULL;
ppActivates[i]->GetAllocatedString(MFT_FRIENDLY_NAME_Attribute, &pszName, NULL);
m_strNames.Add(CAtlStringW(pszName));
item.pszText = m_strNames.GetAt(m_strNames.GetCount() - 1).GetBuffer();
item.lParam = (LPARAM) m_Activates.GetCount() - 1;
treeInserter.item = item;
TreeView_InsertItem(m_hList, &treeInserter);
CoTaskMemFree(pszName);
}
CoTaskMemFree(ppActivates);
}
示例3: GetString
CAtlString RegValue::GetString(LPCTSTR lpValue)
{
CheckReadPerissions();
DWORD dLen;
DWORD dwType;
m_stResult = ::RegQueryValueEx( (HKEY)m_hKey.m_h, lpValue, 0, &dwType, NULL, &dLen);
CheckError("Can't query registry value");
if (dwType != REG_SZ)
throw std::runtime_error("Incompatible types");
CAtlString str;
m_stResult = ::RegQueryValueEx( (HKEY)m_hKey.m_h, lpValue, 0, NULL,
(LPBYTE)str.GetBuffer(dLen / sizeof(TCHAR) + 1), &dLen);
CheckError("Can't query registry value");
str.ReleaseBuffer(dLen / sizeof(TCHAR));
str.ReleaseBuffer();
return str;
}
示例4: rho_sysimpl_get_property
int rho_sysimpl_get_property(char* szPropName, VALUE* resValue)
{
if (strcasecmp("webview_framework",szPropName) == 0)
{
#ifdef RHODES_EMULATOR
*resValue = rho_ruby_create_string("WEBKIT/" QTWEBKIT_VERSION_STR);
#elif defined(APP_BUILD_CAPABILITY_WEBKIT_BROWSER)
*resValue = rho_ruby_create_string("WEBKIT");
#else
rho::String msieVer = "IE";
get_msie_version(msieVer);
*resValue = rho_ruby_create_string(msieVer.c_str());
#endif
return 1;
}
#ifdef RHODES_EMULATOR
if (strcasecmp("main_window_closed",szPropName) == 0)
{*resValue = rho_ruby_create_boolean(CMainWindow::mainWindowClosed); return 1;}
#endif
if (strcasecmp("has_camera",szPropName) == 0)
{*resValue = rho_ruby_create_boolean(has_camera()); return 1;}
if (strcasecmp("phone_number",szPropName) == 0)
{*resValue = phone_number();return 1;}
if (strcasecmp("ppi_x",szPropName) == 0)
{*resValue = rho_ruby_create_double(get_screen_ppi_x()); return 1;}
if (strcasecmp("ppi_y",szPropName) == 0)
{*resValue = rho_ruby_create_double(get_screen_ppi_y()); return 1; }
if (strcasecmp("locale",szPropName) == 0)
{*resValue = rho_sys_get_locale(); return 1;}
if (strcasecmp("country",szPropName) == 0)
{
wchar_t szCountry[20];
int nRes = GetLocaleInfo(LOCALE_USER_DEFAULT,LOCALE_SISO3166CTRYNAME , szCountry, sizeof(szCountry)/sizeof(szCountry[0]));
szCountry[2] = 0;
*resValue = rho_ruby_create_string(convertToStringA(szCountry).c_str());
return 1;
}
if (strcasecmp("device_name",szPropName) == 0)
{
#ifdef OS_WINDOWS
*resValue = rho_ruby_create_string("Win32");
return 1;
#else
HKEY hKey;
int nRes = 0;
if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Ident"),
0, KEY_READ, &hKey ) != ERROR_SUCCESS)
return nRes;
DWORD dwType = REG_SZ;
DWORD dwDataSize = 0;
if ( RegQueryValueEx( hKey, _T("name"), 0, &dwType, (PBYTE)NULL, &dwDataSize ) == ERROR_SUCCESS)
{
CAtlString deviceName;
RegQueryValueEx( hKey, _T("name"), 0, &dwType,
(PBYTE)deviceName.GetBuffer((dwDataSize/sizeof(TCHAR) + sizeof(TCHAR))), &dwDataSize );
deviceName.ReleaseBuffer();
*resValue = rho_ruby_create_string( convertToStringA(deviceName.GetString()).c_str() );
nRes = 1;
}
RegCloseKey(hKey);
return nRes;
#endif
}
if (strcasecmp("os_version",szPropName) == 0)
{
OSVERSIONINFO osv;
osv.dwOSVersionInfoSize = sizeof(osv);
if (!GetVersionEx(&osv))
return 0;
char buf[50];
buf[sizeof(buf) - 1] = '\0';
snprintf(buf, sizeof(buf) - 1, "%u.%u.%u", (unsigned)osv.dwMajorVersion,
(unsigned)osv.dwMinorVersion, (unsigned)osv.dwBuildNumber);
*resValue = rho_ruby_create_string(&buf[0]);
return 1;
}
if (strcasecmp("is_emulator",szPropName) == 0)
{
bool bEmulator = false;
#ifdef OS_WINDOWS
bEmulator = true;
#else
#endif
*resValue = rho_ruby_create_boolean(bEmulator?1:0);
//.........这里部分代码省略.........