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


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

本文整理汇总了C++中CAtlStringW::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlStringW::Format方法的具体用法?C++ CAtlStringW::Format怎么用?C++ CAtlStringW::Format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CAtlStringW的用法示例。


在下文中一共展示了CAtlStringW::Format方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateHistory

HRESULT CDBHistory::UpdateHistory(HDBCONNECTION hDBConnection,
									int nIndex,
									LPCWSTR lpszComment,
									BSTR* pbstrResult)
{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CDynamicAccessor> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;

		strCommand.Format(QUERY_HISTORY_UPDATE, lpszComment, nIndex);

		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBHistory]-[UPDATE] SUCCEEDED :::\n"));
		}
	}

	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:33,代码来源:DBHistory.cpp

示例2: OpenDataSource

HRESULT CDBConnection::OpenDataSource(LPCWSTR lpszPathFileName, LPCWSTR lpszUserName, LPCWSTR lpszPassword)
{
	_ASSERTE(lpszPathFileName != NULL);
	_ASSERTE(lpszUserName != NULL);
	_ASSERTE(lpszPassword != NULL);

	USES_CONVERSION;

	HRESULT hr = E_FAIL;

	if (lpszPathFileName != NULL && lpszUserName != NULL && lpszPassword != NULL)
	{
		if (::PathFileExists(lpszPathFileName))
		{
			CAtlStringW strConnection;

			strConnection.Format(
#if defined(USES_JET_OLEDB_DRIVER)
				L"Provider=Microsoft.Jet.OLEDB.4.0;"
#else
				L"Provider=Microsoft.ACE.OLEDB.12.0;"
#endif
				L"Data Source=%s;"
				L"User ID=%s;"
				L"Mode=Share Deny None;"
				L"Extended Properties=\"\";"
				L"Jet OLEDB:System database=\"\";"
				L"Jet OLEDB:Registry Path=\"\";"
				L"Jet OLEDB:Database Password=\"%s\";"
				L"Jet OLEDB:Engine Type=5;"
				L"Jet OLEDB:Database Locking Mode=1;"
				L"Jet OLEDB:Global Partial Bulk Ops=2;"
				L"Jet OLEDB:Global Bulk Transactions=1;"
				L"Jet OLEDB:New Database Password=\"\";"
				L"Jet OLEDB:Create System Database=False;"
				L"Jet OLEDB:Encrypt Database=False;"
				L"Jet OLEDB:Don't Copy Locale on Compact=False;"
				L"Jet OLEDB:Compact Without Replica Repair=False;"
				L"Jet OLEDB:SFP=False"
				, lpszPathFileName, lpszUserName, lpszPassword);

			hr = Open(LPCWSTR(strConnection));

			if (FAILED(hr))
			{
#ifdef _DEBUG
				ATL::AtlTraceErrorRecords(hr);
#endif
			}
		}
		else
			hr = HRESULT_FROM_WIN32(::GetLastError());
	}
	else
		hr = E_POINTER;


	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:59,代码来源:DBConnection.cpp

示例3: QueryHistory

HRESULT CDBHistory::QueryHistory(HDBCONNECTION hDBConnection, 
						LPCWSTR lpszSerialNum,
						LPDB_HISTORY_COMMON pRecord,
						BSTR* pbstrResult)

{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CAccessor<IMT::CDBHistory>> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;
		CAtlStringW strTemp;
		strCommand.Format(QUERY_HISTORY_SELECT L" WHERE ");

		BOOL isExist = FALSE;

		strTemp.Format(L"SerialNum = '%s'", lpszSerialNum);//L"SerialNum = '%s'", lpszSerial);//
		strCommand += strTemp;

		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBUser]-[QUERY] SUCCEEDED :::\n"));

			hr = Command.MoveNext();
			if (hr == S_OK)
				::CopyMemory(pRecord, LPDB_HISTORY_COMMON(Command), sizeof(DB_HISTORY_COMMON));
		}
	}

	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:43,代码来源:DBHistory.cpp

示例4: AddHistory

HRESULT CDBHistory::AddHistory(HDBCONNECTION hDBConnection, 
								DB_HISTORY_COMMON dbHistory,
								BSTR* pbstrResult)
{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CDynamicAccessor> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;

		strCommand.Format(QUERY_HISTORY_INSERT,
							dbHistory.dateTime.year,
							dbHistory.dateTime.month,
							dbHistory.dateTime.day,
							dbHistory.dateTime.hour,
							dbHistory.dateTime.minute,
							dbHistory.dateTime.second,
							dbHistory.nLRUIdx,
							dbHistory.wszSerialNum,
							dbHistory.wszSRUName,
							dbHistory.nInspectType,
							dbHistory.wszItem,
							dbHistory.nBIT,
							dbHistory.lPresentedResult,
							dbHistory.wszID,
							dbHistory.wszComment,
							dbHistory.l_Index);

		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBHistory]-[INSERT] SUCCEEDED :::\n"));
		}
	}

	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:48,代码来源:DBHistory.cpp

示例5: AddHistoryExternal

HRESULT CDBHistroy_External::AddHistoryExternal(HDBCONNECTION hDBConnection, 
									DB_EXTERNAL dbExternal,
									BSTR* pbstrResult)
{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CDynamicAccessor> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;

		strCommand.Format(QUERY_H_EXTERNAL_INSERT,
						dbExternal.dbHistory.dateTime.year,
						dbExternal.dbHistory.dateTime.month,
						dbExternal.dbHistory.dateTime.day,
						dbExternal.dbHistory.dateTime.hour,
						dbExternal.dbHistory.dateTime.minute,
						dbExternal.dbHistory.dateTime.second,
						dbExternal.wszInspectionItem,
						dbExternal.wszLRUPort,
						dbExternal.wszCable,
						dbExternal.wszInspectionSignal,
						dbExternal.wszInterlockPort,
						dbExternal.dbHistory.bResult,
						dbExternal.dbHistory.wszID,
						dbExternal.dbHistory.wszComment);

		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBHistroy_External]-[INSERT] SUCCEEDED :::\n"));
		}
	}

	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:46,代码来源:DBHistory_External.cpp

示例6: AddHistoryBIT

HRESULT CDBHistroy_BIT::AddHistoryBIT(HDBCONNECTION hDBConnection, 
									DB_BIT dbBIT,
									BSTR* pbstrResult)
{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CDynamicAccessor> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;

		strCommand.Format(QUERY_H_BIT_INSERT,
							dbBIT.dbHistory.dateTime.year,
							dbBIT.dbHistory.dateTime.month,
							dbBIT.dbHistory.dateTime.day,
							dbBIT.dbHistory.dateTime.hour,
							dbBIT.dbHistory.dateTime.minute,
							dbBIT.dbHistory.dateTime.second,
							dbBIT.wszInstrumentName,
							dbBIT.dbHistory.nBIT,
							dbBIT.wszInspectionItem,
							dbBIT.dbHistory.lPresentedResult,
							dbBIT.dbHistory.wszComment,
							dbBIT.bMainSection);

		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBHistroy_BIT]-[INSERT] SUCCEEDED :::\n"));
		}
	}

	/*SELECT MAX(rowId) FROM property */

	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:46,代码来源:DBHistory_BIT.cpp

示例7: bsQuery

HRESULT CIIS7XMLConfigHelper::RemoveModuleNodes(IXMLDOMDocument* pDoc, LPCSTR pszModuleName)
{
	if (pDoc == NULL || pszModuleName == NULL)
		return E_POINTER;

	CAtlStringW sQuery;
	sQuery.Format(L"//add[@name='%hs']", pszModuleName);	

	CComBSTR bsQuery(sQuery);

	CComPtr<IXMLDOMNodeList> pModuleNodes;
	HRESULT hr = pDoc->selectNodes(bsQuery, &pModuleNodes);

	if (hr == S_OK)
	{
		LONG nModules = 0;
		hr = pModuleNodes->get_length(&nModules);

		for (LONG i = 0; i < nModules; i++)
		{
			CComPtr<IXMLDOMNode> pModuleNode;
			hr = pModuleNodes->get_item(i, &pModuleNode);
			if (hr != S_OK || pModuleNode == NULL)
				continue;

			CComPtr<IXMLDOMNode> pParentNode;
			hr = pModuleNode->get_parentNode(&pParentNode);
			if (hr != S_OK || pParentNode == NULL)
				continue;

			CComPtr<IXMLDOMNode> pTemp;
			hr = pParentNode->removeChild(pModuleNode, &pTemp);
			if (hr != S_OK)
				break;
		}
	}

	return hr;
}
开发者ID:UIKit0,项目名称:IISxpress,代码行数:39,代码来源:IIS7XMLConfigHelper.cpp

示例8: QueryHistoryBIT_InspRecord

HRESULT CDBHistroy_BIT::QueryHistoryBIT_InspRecord(HDBCONNECTION hDBConnection,
													long l_Index,
													LPDB_BIT pRecord,
													BSTR* pbstrResult)
{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CAccessor<IMT::CDBHistroy_BIT>> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;
		CAtlStringW strTemp;

		strCommand.Format(QUERY_H_BIT_SELECT L" WHERE Index = %d", l_Index);
		
		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBHistroy_BIT]-[QUERY] SUCCEEDED :::\n"));
			hr = Command.MoveNext();
			if (hr == S_OK)
				::CopyMemory(pRecord, LPDB_BIT(Command), sizeof(DB_BIT));
		}
	}

	return hr;
}
开发者ID:Hpark11,项目名称:FIES,代码行数:37,代码来源:DBHistory_BIT.cpp

示例9: QueryHistory_InspectionRecord

HRESULT CDBHistory::QueryHistory_InspectionRecord(HDBCONNECTION hDBConnection, 
													SYSTEMTIME sysTimeFrom,
													SYSTEMTIME sysTimeTo,
													long l_LRUIndex,
													LPCWSTR lpszSerial,
													long	lResult,
													LPCWSTR lpszUserID,
													long	l_Index,
													LPDB_HISTORY_COMMON pRecord,
													BSTR* pbstrResult)
{
	HRESULT hr = E_FAIL;

	IMT::CDBConnection* pDBConnection = reinterpret_cast<IMT::CDBConnection*>(hDBConnection);
	if (pDBConnection != NULL)
	{
		ATL::CCommand<ATL::CAccessor<IMT::CDBHistory>> Command;

		ATL::CDBPropSet _DBPropSet(DBPROPSET_ROWSET);
		pDBConnection->GetRowsetProperties(&_DBPropSet);

		CAtlStringW strCommand;
		CAtlStringW strTemp;
		strCommand.Format(QUERY_USER_BY_VALID_CONDITIONS, sysTimeFrom.wYear,
														  sysTimeFrom.wMonth,
														  sysTimeFrom.wDay,
														  sysTimeTo.wYear,
														  sysTimeTo.wMonth,
														  sysTimeTo.wDay);

		BOOL isExist = FALSE;

		strTemp = strCommand;
		strCommand += L"AND ";

		if(l_LRUIndex != 0)
		{
			strTemp.Format(L"(LRU_Index = %d) ", l_LRUIndex);
			strCommand += strTemp;
			strTemp = strCommand;
			strCommand += L"AND ";
		}
		else
			TRACE(L"");

		if(::lstrcmpi(lpszSerial, L"Àüü") != 0)
		{
			strTemp.Format(L"(SerialNum = '%s') ", lpszSerial);
			strCommand += strTemp;
			strTemp = strCommand;
			strCommand += L"AND ";
		}
		else
			TRACE(L"");

		if(lResult != dfRESULT_ALL)
		{
			strTemp.Format(L"(State = %d) ", lResult);
			strCommand += strTemp;
			strTemp = strCommand;
			strCommand += L"AND ";
		}
		else
			TRACE(L"");

		if(::lstrcmpi(lpszUserID, L"Àüü") != 0)
		{
			strTemp.Format(L"(User = '%s') ", lpszUserID);
			strCommand += strTemp;
			strTemp = strCommand;
			strCommand += L"AND ";
		}
		else
			TRACE(L"");

		if(::lstrcmpi(strCommand.Right(4), L"AND ") == 0)
		{
			strCommand = strTemp;
		}
		else
			TRACE(L"");


		hr = Command.Open(ATL::CSession(*pDBConnection), strCommand, &_DBPropSet);
		if (hr != S_OK)
		{
			if (pbstrResult != NULL)
				IMT::GetDBErrorString(hr, pbstrResult);
		}
		else
		{
			TRACE(_T(":::[CDBHistory]-[QUERY] SUCCEEDED :::\n"));
			for(long i = 0; i < l_Index; i++)
			{
				hr = Command.MoveNext();
			}
			if (hr == S_OK)
				::CopyMemory(pRecord, LPDB_HISTORY_COMMON(Command), sizeof(DB_HISTORY_COMMON));
		}
	}
//.........这里部分代码省略.........
开发者ID:Hpark11,项目名称:FIES,代码行数:101,代码来源:DBHistory.cpp

示例10: ToString

CAtlStringW ToString(int n)
{
    CAtlStringW result;
    result.Format(L"%i", n);
    return result;
}
开发者ID:15375514460,项目名称:TortoiseGit,代码行数:6,代码来源:CrashProcessor.cpp

示例11: WriteContentPropertiesBulk


//.........这里部分代码省略.........
            hr = CoCreateInstance(CLSID_PortableDeviceValues,
                                  NULL,
                                  CLSCTX_INPROC_SERVER,
                                  IID_PPV_ARGS(&pValues));
            if (FAILED(hr))
            {
                printf("! Failed to CoCreate CLSID_PortableDeviceValues, hr = 0x%lx\n", hr);
            }

            // Get the Object ID whose properties we will set
            if (hr == S_OK)
            {
                hr = pObjectIDs->GetAt(dwIndex, &pv);
                if (FAILED(hr))
                {
                    printf("! Failed to get next Object ID from list, hr = 0x%lx\n", hr);
                }
            }

            // Save them into the IPortableDeviceValues so the driver knows which object this proeprty set belongs to
            if (hr == S_OK)
            {
                hr = pValues->SetStringValue(WPD_OBJECT_ID, pv.pwszVal);
                if (FAILED(hr))
                {
                    printf("! Failed to set WPD_OBJECT_ID, hr = 0x%lx\n", hr);
                }
            }

            // Set the new values.  In this sample, we attempt to set the name property.
            if (hr == S_OK)
            {
                CAtlStringW strValue;
                strValue.Format(L"NewName%d", dwIndex);

                hr = pValues->SetStringValue(WPD_OBJECT_NAME, strValue.GetString());
                if (FAILED(hr))
                {
                    printf("! Failed to set WPD_OBJECT_NAME, hr = 0x%lx\n", hr);
                }
            }

            // Add this property set to the collection
            if (hr == S_OK)
            {
                hr = pPropertiesToWrite->Add(pValues);
                if (FAILED(hr))
                {
                    printf("! Failed to add values to collection, hr = 0x%lx\n", hr);
                }
            }
            PropVariantClear(&pv);
        }
    }

    // 9) Call QueueSetValuesByObjectList to initialize the Asynchronous
    // property operation.
    if (SUCCEEDED(hr))
    {
        hr = pPropertiesBulk->QueueSetValuesByObjectList(pPropertiesToWrite,
                                                         pCallback,
                                                         &guidContext);
        // 10) Call Start() to actually being the property operation
        if(SUCCEEDED(hr))
        {
            // Cleanup any previously created global event handles.
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:67,代码来源:ContentProperties.cpp


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