当前位置: 首页>>代码示例>>C++>>正文


C++ CAtlString::Format方法代码示例

本文整理汇总了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;
}
开发者ID:ki0ki0,项目名称:sudoWin,代码行数:34,代码来源:Runner.cpp

示例2: GetErrorDescription

CAtlString GetErrorDescription(HRESULT hr)
{

	CAtlString aStr;
	aStr.Format("HRESULT=0x%x; ErrorString=%s; Description=%s", hr, DXGetErrorString8(hr), DXGetErrorDescription8(hr));
	return aStr; 
}
开发者ID:codeboost,项目名称:libertv,代码行数:7,代码来源:FMPlayerDShow.cpp

示例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;
	}
开发者ID:bahamut8348,项目名称:xkcode,代码行数:7,代码来源:pyPort.cpp

示例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();
}
开发者ID:moon-sky,项目名称:fishjam-template-library,代码行数:31,代码来源:FilePage.cpp

示例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);
}
开发者ID:UIKit0,项目名称:IISxpress,代码行数:19,代码来源:IIS7XMLConfigHelper.cpp

示例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;
}
开发者ID:UIKit0,项目名称:IISxpress,代码行数:67,代码来源:IIS7XMLConfigHelper.cpp


注:本文中的CAtlString::Format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。