本文整理汇总了C++中CAtlString类的典型用法代码示例。如果您正苦于以下问题:C++ CAtlString类的具体用法?C++ CAtlString怎么用?C++ CAtlString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAtlString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogPath
void CIISxpressHttpModule::OpenLog(IHttpContext* pHttpContext)
{
if (pHttpContext != NULL && m_Config.GetLoggingLevel() >= IISXPRESS_LOGGINGLEVEL_BASIC)
{
CAtlString installPath;
m_Config.GetInstallPath(installPath);
if (installPath.GetLength() > 0)
{
CPathT<CAtlString> LogPath(installPath);
LogPath.Append(_T("\\Logs"));
if (LogPath.IsDirectory() == FALSE)
{
::CreateDirectory(LogPath, NULL);
}
CAtlString sLogFilePrefix;
sLogFilePrefix.LoadString(IDS_LOGFILENAMEPREFIX);
CAtlString sAppName;
if (GetAppPoolName(pHttpContext, sAppName) == true)
{
sLogFilePrefix += sAppName;
sLogFilePrefix += "-";
}
m_Log.Init(LogPath, sLogFilePrefix, _T("log"));
}
}
}
示例2: GetErrorDescription
CAtlString GetErrorDescription(HRESULT hr)
{
CAtlString aStr;
aStr.Format("HRESULT=0x%x; ErrorString=%s; Description=%s", hr, DXGetErrorString8(hr), DXGetErrorDescription8(hr));
return aStr;
}
示例3: hEventRun
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;
}
示例4: Desc
std::wstring Desc() const
{
CAtlString s;
s.Format(L"<TCP PID:%d Local:(%s:%d) Remote:(%s:%d), State:%d>",
dwOwningPid, Local().c_str(), dwLocalPort, Remote().c_str(), dwRemotePort, dwState);
return (LPCTSTR)s;
}
示例5: CFIocpCopyFileTask
void CFilePage::OnBnClickedBtnIocpTest()
{
//BOOL bRet = FALSE;
BOOL bRet = FALSE;
//CFIocpFileReadTask fileReadTask;
//API_VERIFY(fileReadTask.Create(TEXT("D:\\test.jpg"),
// GENERIC_WRITE | GENERIC_READ,
// FILE_SHARE_READ, NULL,
// OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED));
CFElapseCounter counter;
for (INT i = 0; i < m_nCopyFileCount; i++)
{
CFIocpCopyFileTask* pFileCopyTask = new CFIocpCopyFileTask(&m_iocpMgr);
CAtlString strTagetFile;
strTagetFile.Format(TEXT("E:\\TargetCopy_%d.txt"), counter.GetElapseTime() % LONG_MAX);
pFileCopyTask->OpenFiles(m_strCopySrcFile, strTagetFile);
m_iocpMgr.AssociateTask(pFileCopyTask, TRUE);
}
//fileIocpTask.m_OverLapped.overLapped.Offset = 0;
//fileIocpTask.WriteFileHeader((LPOVERLAPPED)&fileIocpTask.m_OverLapped);
//fileReadTask.Close();
//iocpMgr.Stop();
//iocpMgr.Close();
}
示例6: LoadString
std::wstring Helpers::LoadString(UINT uID)
{
CAtlString localized;
if(localized.LoadStringW(uID))
return std::wstring(localized);
else
return std::wstring(L"LoadString failed");
}
示例7: adjust
void CChatLog::adjust(const TCHAR* format, ...)
{
CAtlString cs;
va_list ap;
va_start(ap, format);
cs.FormatV(format, ap);
va_end(ap);
write(reinterpret_cast<const void*>(static_cast<const TCHAR*>(cs)), cs.GetLength());
}
示例8: MakeVariantNotArray
/*
* Converts the specified (sub-)string into a Variant value.
*/
CComVariant CMELCommand::MakeVariantNotArray(const CAtlString& strText)
{
CComVariant variant(strText);
if (strText.SpanExcluding(L"0123456789.-+e").IsEmpty()) {
if (strText.Find(L".") < 0) {
variant.ChangeType(VT_I4);
} else {
variant.ChangeType(VT_R8);
}
}
return variant;
}
示例9: AddDialogToTree
HTREEITEM DlgSettingsMain::AddDialogToTree(const UINT id, const std::shared_ptr<DlgSettingsBase>& newDlg, CRect& rect, HTREEITEM htiParent /*= NULL*/)
{
newDlg->Create(m_hWnd, rect);
newDlg->SetWindowPos(HWND_TOP, rect.left, rect.top, 0, 0, SWP_NOSIZE);
CAtlString strName;
strName.LoadString (id);
HTREEITEM hItem = m_treeCtrl.InsertItem(strName, htiParent, NULL);
if (hItem != NULL) m_settingsDlgMap.insert(SettingsDlgsMap::value_type(hItem, newDlg));
return hItem;
}
示例10: debugout
virtual void debugout(TCHAR* format, ...)
{
CAtlString ds;
va_list ap;
va_start(ap, format);
ds.FormatV(format, ap);
va_end(ap);
if (_out_type == DEBUGOUT_STRING)
_output_string(ds);
else if (_out_type == DEBUGOUT_FILE)
_output_file(ds);
}
示例11: LoadAtlString
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);
}
示例12: CAtlString
bool CIISxpressHttpModule::GetAppPoolName(IHttpContext* pHttpContext, CAtlString& name)
{
bool status = false;
if (m_pHttpServer != NULL)
{
LPCWSTR pszAppPoolName = m_pHttpServer->GetAppPoolName();
if (pszAppPoolName != NULL)
{
name = CAtlString(pszAppPoolName);
status = true;
}
}
// if we didn't get the application pool name from the server then at least try and fall back to the application id
if (!status && pHttpContext != NULL)
{
IHttpApplication* pApp = pHttpContext->GetApplication();
if (pApp != NULL)
{
PCWSTR pszAppId = pApp->GetApplicationId();
if (pszAppId != NULL)
{
name = CAtlString(pszAppId);
name.Replace('/', '_');
status = true;
}
}
}
return status;
}
示例13: SplitString
size_t Misc::SplitString(const CString & str, LPCTSTR tokens, CAtlList<CString> & list)
{
list.RemoveAll();
CAtlString token;
int curPos = 0;
token = str.Tokenize(tokens, curPos);
while (-1 != curPos)
{
if (!token.IsEmpty())
{
list.AddTail(token);
}
token = str.Tokenize(tokens, curPos);
}
return list.GetCount();
}
示例14:
HRESULT CIIS7XMLConfigHelper::GetSiteNode(IXMLDOMDocument* pDoc, LPCWSTR pszId, IXMLDOMNode** ppSite)
{
if (pDoc == NULL || pszId == NULL || ppSite == NULL)
return E_POINTER;
// we want the site corresponding to the instance string
CAtlString sSitesQuery;
sSitesQuery.Format(_T("/configuration/system.applicationHost/sites/site[@id='%ls']"), pszId);
CComPtr<IXMLDOMNode> pSite;
HRESULT hr = pDoc->selectSingleNode(CComBSTR(sSitesQuery), &pSite);
if (hr != S_OK)
return hr;
if (pSite == NULL)
return E_FAIL;
return pSite.CopyTo(ppSite);
}
示例15: CheckReadPerissions
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;
}