本文整理汇总了C++中CComBSTR::Append方法的典型用法代码示例。如果您正苦于以下问题:C++ CComBSTR::Append方法的具体用法?C++ CComBSTR::Append怎么用?C++ CComBSTR::Append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComBSTR
的用法示例。
在下文中一共展示了CComBSTR::Append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCardinality
//수행도중 에러가 나도 S_OK 리턴
//에러시 cardinality는 0이 된다.
static HRESULT GetCardinality(int hConn, WCHAR* tableName, ULARGE_INTEGER* cardinality)
{
CComBSTR query;
T_CCI_ERROR error;
int hReq, res, ind;
query.Append("select count(*) from ");
query.Append(tableName);
hReq = cci_prepare(hConn, CW2A(query.m_str), 0, &error);
if (hReq < 0)
return S_OK;
res = cci_execute(hReq, CCI_EXEC_QUERY_ALL, 0, &error);
if (res < 0)
return S_OK;
res = cci_cursor(hReq, 1, CCI_CURSOR_FIRST, &error);
if(res<0) return S_OK;
res = cci_fetch(hReq, &error);
if(res<0) return S_OK;
res = cci_get_data(hReq, 1, CCI_A_TYPE_INT, &cardinality->QuadPart, &ind);
if(res<0) return S_OK;
cci_close_req_handle(hReq);
return S_OK;
}
示例2: SetValueAsString
HRESULT Property::SetValueAsString(
LPCOLESTR pszValue,
DWORD dwRadix,
DWORD dwTimeout )
{
// even though it could be read only, let's parse and eval, so we get good errors
HRESULT hr = S_OK;
CComBSTR assignExprText = mFullExprText;
CComBSTR errStr;
UINT errPos;
CComPtr<IDebugExpression2> expr;
CComPtr<IDebugProperty2> prop;
if ( assignExprText == NULL )
return E_OUTOFMEMORY;
hr = assignExprText.Append( L" = " );
if ( FAILED( hr ) )
return hr;
hr = assignExprText.Append( pszValue );
if ( FAILED( hr ) )
return hr;
hr = mExprContext->ParseText( assignExprText, 0, dwRadix, &expr, &errStr, &errPos );
if ( FAILED( hr ) )
return hr;
hr = expr->EvaluateSync( 0, dwTimeout, NULL, &prop );
if ( FAILED( hr ) )
return hr;
return S_OK;
}
示例3: GenerateError
HRESULT GenerateError (REFCLSID rClsId, REFIID riid, LPCOLESTR pcHelpFile, HRESULT hRes) {
#endif
CComBSTR strMsgLine;
DWORD dwErr = FormatMessageLine( strMsgLine, hRes, NULL );
#if defined(_DEBUG)
USES_CONVERSION;
if( dwErr ) {
LPTSTR lptMsg = NULL;
CComBSTR strMsg(L"\n---------------------- Fehler beim Erzeugen der Fehlermeldung ----------------------\n");
if( ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, dwErr, 1024, (LPTSTR) &lptMsg, 0, NULL ) ) {
USES_CONVERSION;
strMsg.Append( A2W(lptMsg) );
::LocalFree(lptMsg);
if( 0x716 == dwErr ) {
strMsg.Append(L"\n----------------------------------------------------------------------------------------");
strMsg.Append( L"\nHat die Message-Ressource den Wert 1? ;-)" );
}
strMsg.Append(L"\n----------------------------------------------------------------------------------------");
_CrtDbgReport(_CRT_ASSERT, strFile, line, NULL, W2A(strMsg) );
return E_FAIL;
}
}
CComBSTR strDbgLine;
FormatDebuggerLine( strDbgLine, hRes, strFile, line, strExpr );
strDbgLine.Append( _T("\t") );
strDbgLine.Append( strMsgLine );
strDbgLine.Append( _T("\n") );
{ ATLTRACE( W2A(strDbgLine) ); }
#endif
DWORD dwHelpID = hRes;
return AtlReportError(rClsId, strMsgLine, dwHelpID, pcHelpFile, riid, hRes);
}
示例4: plane_type
CComPtr<ISketchSegment> sketchGridHole(int grid_number,
CComPtr<IModelDoc2> swModel,
CComPtr<IModelDocExtension> swModelDocExt,
CComPtr<ISketchManager> swSketchManager, double HoleRadiusMM) {
CComBSTR plane_type(L"PLANE");
CComBSTR plane = "Plane";
// Append plane number to the end of the 'plane' string
char buffer [5];
_itoa_s(grid_number, buffer, 10);
plane.Append(buffer);
CComPtr<IDispatch> swSketchSegmentUnknown;
CComPtr<ISketchSegment> swSketchSegment;
VARIANT_BOOL returnBoolean;
insureExecution(swModel->ClearSelection(), __LINE__);
insureExecution(swModelDocExt->SelectByID2(plane, plane_type, 0, 0, 0, true, 0, NULL, 0, &returnBoolean), __LINE__);
swModel->CreateCircleByRadius2(0,0,0, HoleRadiusMM*MM_TO_M, &swSketchSegmentUnknown); // For some reason this always comes back false, so insuringExecution is not helpful
swSketchSegment = swSketchSegmentUnknown;
return swSketchSegment;
}
示例5: SaveWhiteboardSettings
/****************************************
** Author: Joe Li
** Purpose: Save whiteboard settings data
** Comments:
****************************************/
bool DOSaveAppData::SaveWhiteboardSettings(const CComBSTR& sourcePath, const CComBSTR& sourceFileName, const CComBSTR& targetPath)
{
DOPersistentFile sourceFile;
// Open source file for reading
if (sourceFile.OpenFile(sourcePath, sourceFileName, DOFile::DO_FILE_OPEN_EXISTING, DOFile::DO_FILE_READ) == true)
{
SetDateTime();
CComBSTR targetFileName = m_dateTime;
targetFileName.Append(sourceFileName);
DORemovableStorageFile targetFile;
bool targetFileOpen = true;
// Open existing target file
if (targetFile.OpenFile(targetPath, targetFileName, DOFile::DO_FILE_TRUNCATE_EXISTING) == false)
// Create target file if open existing file failed
if (targetFile.OpenFile(targetPath, targetFileName) == false)
targetFileOpen = false;
if (targetFileOpen == true)
{
DOFileUtility fileUtility;
return fileUtility.CopyFileContents(&sourceFile, &targetFile);
}
}
return false;
}
示例6: FetchAll
STDMETHODIMP CSimplePointDatasetHelper::FetchAll(long ClassIndex, BSTR WhereClause, VARIANT FieldMap, IPlugInCursorHelper **cursorHelper)
{
HRESULT hr;
if (! cursorHelper) return E_POINTER;
// Some parameters can be ignored since,
// ClassIndex is only relevant to feature datasets
// WhereClause is not appropriate since we are not supporting SQL
ISimplePointCursorHelperPtr ipSimplePointCursorHelper;
hr = ipSimplePointCursorHelper.CreateInstance(CLSID_SimplePointCursorHelper);
if (FAILED(hr)) return hr;
hr = ipSimplePointCursorHelper->put_FieldMap(FieldMap);
if (FAILED(hr)) return hr;
IFieldsPtr ipFields;
hr = get_Fields(0, &ipFields);
if (FAILED(hr)) return hr;
hr = ipSimplePointCursorHelper->putref_Fields(ipFields);
if (FAILED(hr)) return hr;
CComBSTR sFilePath;
sFilePath = m_sWorkspacePath;
sFilePath.Append(m_sDatasetName);
hr = ipSimplePointCursorHelper->put_FilePath(sFilePath);
if (FAILED(hr)) return hr;
IPlugInCursorHelperPtr ipPlugInCursorHelper;
ipPlugInCursorHelper = ipSimplePointCursorHelper;
if (ipPlugInCursorHelper == NULL) return E_FAIL;
*cursorHelper = ipPlugInCursorHelper.Detach(); // Pass ownership of object back to client
return S_OK;
}
示例7: BuildColumnValue
static CComBSTR BuildColumnValue(ATLCOLUMNINFO *m_pInfoCur, CCUBRIDRowsetRowColumn *pColCur)
{
if(pColCur->m_dwStatus==DBSTATUS_S_ISNULL)
return "NULL";
// TODO: type.*의 prefix, suffix 정보를 이용해서 구현
CComBSTR str;
CString temp(pColCur->m_strData);
switch(m_pInfoCur->wType)
{
case DBTYPE_I2:
case DBTYPE_I4:
case DBTYPE_R4:
case DBTYPE_R8:
case DBTYPE_NUMERIC:
str.Append(pColCur->m_strData);
break;
case DBTYPE_WSTR: // NCHAR?
str.Append("N'");
temp.Replace("'", "''");
str.Append(temp);
str.Append("'");
break;
case DBTYPE_BYTES:
str.Append("X'");
str.Append(pColCur->m_strData);
str.Append("'");
break;
default:
str.Append("'");
temp.Replace("'", "''");
str.Append(temp);
str.Append("'");
break;
}
return str;
}
示例8: CreateAppDomain
// In order to securely load an assembly, its fully qualified strong name
// and not the filename must be used. To do that, the target AppDomain's
// base directory needs to point to the directory where the assembly is.
HRESULT CCLRLoader::CreateAppDomain(LPCWSTR szAssemblyConfigName)
{
USES_CONVERSION;
HRESULT hr = S_OK;
// Ensure the AppDomain is created only once.
if (m_pAppDomain != NULL)
{
return hr;
}
CComPtr<IUnknown> pUnkDomainSetup;
CComPtr<IAppDomainSetup> pDomainSetup;
CComPtr<IUnknown> pUnkAppDomain;
TCHAR szDirectory[MAX_PATH + 1];
TCHAR szAssemblyConfigPath[MAX_PATH + 1];
CComBSTR cbstrAssemblyConfigPath;
// Create an AppDomainSetup with the base directory pointing to the
// location of the managed DLL. We assume that the target assembly
// is located in the same directory.
IfFailGo( m_pCorRuntimeHost->CreateDomainSetup(&pUnkDomainSetup) );
IfFailGo( pUnkDomainSetup->QueryInterface(
__uuidof(pDomainSetup), (LPVOID*)&pDomainSetup) );
// Get the location of the hosting shim DLL, and configure the
// AppDomain to search for assemblies in this location.
IfFailGo( GetDllDirectory(
szDirectory, sizeof(szDirectory)/sizeof(szDirectory[0])) );
pDomainSetup->put_ApplicationBase(CComBSTR(szDirectory));
// Set the AppDomain to use a local DLL config if there is one.
IfFailGo( StringCchCopy(
szAssemblyConfigPath,
sizeof(szAssemblyConfigPath)/sizeof(szAssemblyConfigPath[0]),
szDirectory) );
if (!PathAppend(szAssemblyConfigPath, szAssemblyConfigName))
{
hr = E_UNEXPECTED;
goto Error;
}
IfFailGo( cbstrAssemblyConfigPath.Append(szAssemblyConfigPath) );
IfFailGo( pDomainSetup->put_ConfigurationFile(cbstrAssemblyConfigPath) );
// Create an AppDomain that will run the managed assembly, and get the
// AppDomain's _AppDomain pointer from its IUnknown pointer.
IfFailGo( m_pCorRuntimeHost->CreateDomainEx(T2W(szDirectory),
pUnkDomainSetup, 0, &pUnkAppDomain) );
IfFailGo( pUnkAppDomain->QueryInterface(
__uuidof(m_pAppDomain), (LPVOID*)&m_pAppDomain) );
Error:
return hr;
}
示例9: GetCustomUIMode
//***************************************************************************
// GetCustomUIMode()
// When UI mode of the player OCX is set to custom, this function is called
// to give the skin file path that will be loaded to the player OCX.
//
//***************************************************************************
HRESULT CRemoteHost::GetCustomUIMode(BSTR * pbstrFile)
{
HRESULT hr = E_POINTER;
if (pbstrFile)
{
WCHAR wszCurDir[MAX_PATH];
CComBSTR bstrSkinPath = L"file://";
CComBSTR bstrSkinFilename;
GetCurrentDirectory(MAX_PATH, wszCurDir);
bstrSkinFilename.LoadString(IDS_SKINFILE);
bstrSkinPath.Append(wszCurDir);
bstrSkinPath.Append(L"\\");
bstrSkinPath.Append(bstrSkinFilename);
*pbstrFile = bstrSkinPath.Detach();
hr = *pbstrFile? S_OK : E_POINTER;
}
return hr;
}
示例10: GenerateErrorV
HRESULT GenerateErrorV (REFCLSID rClsId, REFIID riid, LPCOLESTR pcHelpFile, HRESULT hRes, va_list argList) {
#endif
CComBSTR strMsgLine;
DWORD dwErr = FormatMessageLine( strMsgLine, hRes, &argList );
#if defined(_DEBUG)
USES_CONVERSION;
if( dwErr ) {
LPTSTR lptMsg = NULL;
if( ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, dwErr, 1024, (LPTSTR) &lptMsg, 0, NULL ) ) {
_CrtDbgReport(_CRT_ASSERT, strFile, line, NULL, lptMsg );
::LocalFree(lptMsg);
return E_FAIL;
}
}
CComBSTR strDbgLine;
FormatDebuggerLine( strDbgLine, hRes, strFile, line, strExpr );
strDbgLine.Append( _T("\t") );
strDbgLine.Append( strMsgLine );
strDbgLine.Append( _T("\n") );
{ ATLTRACE( W2A(strDbgLine) ); }
#endif
DWORD dwHelpID = hRes;
return AtlReportError(rClsId, strMsgLine, dwHelpID, pcHelpFile, riid, hRes);
}
示例11: GetName
CComBSTR CProjectItemInfo::GetName(CComPtr<ItcProjectNode> node, int index)
{
CComBSTR name;
do
{
index++;
if (FAILED(get_DefaultFileName(&name))) return CComBSTR(_T(""));
TCHAR number[64];
name.Append(_itot(index, number, 10));
}
while (NodeExistsInParent(node, name));
return name;
}
示例12: SaveLog
/****************************************
** Author: Joe Li
** Purpose: Save log file
** Comments:
****************************************/
bool DOSaveAppData::SaveLog(const CComBSTR& targetPath, LOG_TYPE logToSave)
{
HRESULT hr = E_FAIL;
DOLogMaintenanceBase logMaintenance(hr);
if (SUCCEEDED(hr))
{
SetDateTime();
CComBSTR targetLogFileName = m_dateTime;
switch(logToSave)
{
case ALARM_LOG:
targetLogFileName.Append(_T("AlarmLog.txt"));
break;
case ERROR_LOG:
targetLogFileName.Append(_T("ErrorLog.txt"));
break;
case RND_LOG:
targetLogFileName.Append(_T("RnDLog.txt"));
break;
case KEYPRESS_LOG:
targetLogFileName.Append(_T("KeyPressLog.txt"));
break;
case EVENT_LOG:
targetLogFileName.Append(_T("EventLog.txt"));
break;
default:
return false;
}
return logMaintenance.WriteLogEntriesToRemovableStorage(logToSave, targetPath, targetLogFileName);
}
return false;
}
示例13:
STDMETHODIMP CIE2EMUrlTaker::get_Version(BSTR* pVal)
{
try
{
*pVal = CComBSTR(_T("")).Copy();
TCHAR szAppPath[MAX_PATH] = {0};
HMODULE hMySelf = ::GetModuleHandle(_T("IE2EM.dll"));
::GetModuleFileName(hMySelf,szAppPath,MAX_PATH );
INT nVersionLen = ::GetFileVersionInfoSize(szAppPath,NULL);
if( nVersionLen<= 0 )
{
return S_OK;
}
TCHAR* pBuffer=new TCHAR[nVersionLen];
if(!pBuffer)
{
return S_OK;
}
if(!::GetFileVersionInfo(szAppPath,NULL,nVersionLen,pBuffer))
{
return S_OK;
}
UINT dwBytes;
VS_FIXEDFILEINFO* pFileInf = NULL;
if(::VerQueryValue(pBuffer, _T("\\"),(LPVOID*)&pFileInf,&dwBytes))
{
TCHAR cVersion[MAX_PATH]={0};
_sntprintf(cVersion,MAX_PATH,_T("%d.%d.%d.%d"),HIWORD(pFileInf->dwFileVersionMS),LOWORD(pFileInf->dwFileVersionMS),
HIWORD(pFileInf->dwFileVersionLS),LOWORD(pFileInf->dwFileVersionLS));
CComBSTR str;
str.Append(cVersion,MAX_PATH);
*pVal = str.Copy();
}
delete[] pBuffer;
}
catch (...)
{
*pVal = CComBSTR(_T("exception")).Copy();
}
return S_OK;
}
示例14: IsWorkspace
STDMETHODIMP CSimplePointWorkspaceFactory::IsWorkspace(BSTR wksString, VARIANT_BOOL *isWks)
{
USES_CONVERSION;
*isWks = VARIANT_FALSE;
if (!IsDirectory(wksString))
return S_FALSE;
// verify that a .spt file exists
CComBSTR sFilter = "*";
sFilter.Append(g_sExt);
if (!FileTypeExists(OLE2CT(wksString), OLE2CT(sFilter)))
return S_FALSE;
*isWks = VARIANT_TRUE;
return S_OK;
}
开发者ID:Aleksei-Iagur,项目名称:arcobjects-sdk-community-samples,代码行数:18,代码来源:SimplePointWorkspaceFactory.cpp
示例15: OnModuleUnloadInternal
void EventCallback::OnModuleUnloadInternal( DWORD uniquePid, Address64 baseAddr )
{
OutputDebugStringA( "EventCallback::OnModuleUnload\n" );
HRESULT hr = S_OK;
RefPtr<ModuleLoadEvent> event;
RefPtr<Program> prog;
RefPtr<Module> mod;
CComPtr<IDebugModule2> mod2;
CComBSTR msg;
if ( !mEngine->FindProgram( uniquePid, prog ) )
return;
if ( !prog->FindModule( baseAddr, mod ) )
return;
prog->DeleteModule( mod.Get() );
mEngine->UnbindPendingBPsFromModule( mod.Get(), prog.Get() );
hr = MakeCComObject( event );
if ( FAILED( hr ) )
return;
hr = mod->QueryInterface( __uuidof( IDebugModule2 ), (void**) &mod2 );
if ( FAILED( hr ) )
return;
mod->GetPath( msg );
msg.Append( L" unloaded.");
event->Init( mod2, msg.m_str, false );
SendEvent( event.Get(), prog.Get(), NULL );
}