本文整理汇总了C++中CAtlString::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlString::Format方法的具体用法?C++ CAtlString::Format怎么用?C++ CAtlString::Format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlString
的用法示例。
在下文中一共展示了CAtlString::Format方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: GetErrorDescription
CAtlString GetErrorDescription(HRESULT hr)
{
CAtlString aStr;
aStr.Format("HRESULT=0x%x; ErrorString=%s; Description=%s", hr, DXGetErrorString8(hr), DXGetErrorDescription8(hr));
return aStr;
}
示例3: 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;
}
示例4: OnBnClickedBtnIocpTest
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();
}
示例5:
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);
}
示例6: bsQuery
HRESULT CIIS7XMLConfigHelper::AddNativeModuleNode(IXMLDOMDocument* pDoc,
IXMLDOMNode* pModulesNode,
LPCSTR pszModuleName,
LPCSTR pszModulePath,
int bitness)
{
if (pDoc == NULL || pModulesNode == NULL || pszModuleName == NULL)
return E_POINTER;
CAtlStringW sQuery;
sQuery.Format(L"add[@name='%hs']", pszModuleName);
CComBSTR bsQuery(sQuery);
// find the module node, if it doesn't exist then add it
CComPtr<IXMLDOMNode> pModuleNode;
HRESULT hr = pModulesNode->selectSingleNode(bsQuery, &pModuleNode);
if (hr != S_OK || pModuleNode == NULL)
{
hr = pDoc->createNode(CComVariant(NODE_ELEMENT), L"add", L"", &pModuleNode);
if (hr != S_OK || pModuleNode == NULL)
return hr;
CComPtr<IXMLDOMNamedNodeMap> pAttrs;
hr = pModuleNode->get_attributes(&pAttrs);
if (hr != S_OK || pAttrs == NULL)
return hr;
CComPtr<IXMLDOMAttribute> pNameAttr;
hr = pDoc->createAttribute(L"name", &pNameAttr);
if (hr != S_OK || pNameAttr == NULL)
return hr;
hr = pNameAttr->put_text(CComBSTR(pszModuleName));
hr = pAttrs->setNamedItem(pNameAttr, NULL);
if (pszModulePath != NULL)
{
CComPtr<IXMLDOMAttribute> pImageAttr;
hr = pDoc->createAttribute(L"image", &pImageAttr);
if (hr != S_OK || pNameAttr == NULL)
return hr;
hr = pImageAttr->put_text(CComBSTR(pszModulePath));
hr = pAttrs->setNamedItem(pImageAttr, NULL);
}
// set the bitness precondition
if (bitness > 0)
{
CComPtr<IXMLDOMAttribute> pPreconditionAttr;
hr = pDoc->createAttribute(L"preCondition", &pPreconditionAttr);
if (hr != S_OK || pPreconditionAttr == NULL)
return hr;
CAtlString sBitness;
sBitness.Format(_T("bitness%d"), bitness);
hr = pPreconditionAttr->put_text(CComBSTR(sBitness));
hr = pAttrs->setNamedItem(pPreconditionAttr, NULL);
}
hr = pModulesNode->appendChild(pModuleNode, NULL);
}
return hr;
}