本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
}
//.........这里部分代码省略.........
示例10: ToString
CAtlStringW ToString(int n)
{
CAtlStringW result;
result.Format(L"%i", n);
return result;
}
示例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.