本文整理汇总了C++中_bstr_t::length方法的典型用法代码示例。如果您正苦于以下问题:C++ _bstr_t::length方法的具体用法?C++ _bstr_t::length怎么用?C++ _bstr_t::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_bstr_t
的用法示例。
在下文中一共展示了_bstr_t::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: and
//查询时间段内有效的流行线
_RecordsetPtr CFloatRowLine::QueryValidateLines(_bstr_t bstrBeginDate,_bstr_t bstrEndDate)
{
if (bstrBeginDate.length()<=0||bstrEndDate.length()<=0)
{
MessageBox(NULL,_T("请输入有效时间间隔!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_bConntSuccess)
{
MessageBox(NULL,_T("数据库连接失败!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_pDB->CheckTableNameExist("流行线"))
{
MessageBox(NULL,_T("数据库中不存在该流行线业务表!"),_T("提示"),0);
return FALSE;
}
_bstr_t bstrSql;
switch(CDatabaseFactory::m_enumDatabaseType)
{
case AccessType:
bstrSql="select 流行线.编号,名称,所属目标,启用时间,结束时间 from 流行线,流行线属性 where 流行线.编号=流行线属性.所属流行线 and (启用时间<=#"+bstrBeginDate+"# and 结束时间>=#"+bstrBeginDate+"#) or(启用时间>=#"+bstrBeginDate+"# and 结束时间<=#"+bstrEndDate+"#) or(启用时间<=#"+bstrEndDate+"# and 结束时间>=#"+bstrEndDate+"#) order by 流行线.编号";
break;
case SqlServerType:
bstrSql="select 流行线.编号,名称,所属目标,启用时间,结束时间 from 流行线,流行线属性 where 流行线.编号=流行线属性.所属流行线 and (启用时间<='"+bstrBeginDate+"' and 结束时间>='"+bstrBeginDate+"') or(启用时间>='"+bstrBeginDate+"' and 结束时间<='"+bstrEndDate+"') or(启用时间<='"+bstrEndDate+"' and 结束时间>='"+bstrEndDate+"') order by 流行线.编号";
break;
case OracleType:
bstrSql="select 流行线.编号,名称,所属目标,启用时间,结束时间 from 流行线,流行线属性 where 流行线.编号=流行线属性.所属流行线 and (启用时间<=to_date('" + bstrBeginDate + "','dd/mm/yyyy') and 结束时间>=to_date('" + bstrBeginDate + "','dd/mm/yyyy')) or(启用时间>=to_date('" + bstrBeginDate + "','dd/mm/yyyy') and 结束时间<=to_date('" + bstrEndDate + "','dd/mm/yyyy')) or(启用时间<=to_date('" + bstrEndDate + "','dd/mm/yyyy') and 结束时间>=to_date('" + bstrEndDate + "','dd/mm/yyyy')) order by 流行线.编号";
break;
default:
return FALSE;
}
return theBllApp.m_pDB->ExcuteSqlRes(bstrSql,adCmdText);
}
示例2: _bstr_cmp
long _bstr_cmp(const _bstr_t& cmp1, const _bstr_t& cmp2)
{
long nRes = 0;
if (cmp1.length() && cmp2.length())
{
nRes = wcscmp(cmp1, cmp2);
}
else if (cmp1.length() == 0)
{
if (cmp2.length() == 0)
{
nRes = 0;
}
else
{
nRes = -1;
}
}
else
{
nRes = 1;
}
return nRes;
}
示例3: NameValidate
//检查重点目标名称更新
BOOL CEmphasesTarget::NameValidate(_bstr_t bstrName,_bstr_t bstrID)
{
if (bstrName.length()<=0 || bstrID.length()<=0)
{
MessageBox(NULL,_T("请选择要加载重点目标!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_bConntSuccess)
{
MessageBox(NULL,_T("数据库连接失败!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_pDB->CheckTableNameExist("重点目标"))
{
MessageBox(NULL,_T("数据库中不存在该重点目标业务表!"),_T("提示"),0);
return FALSE;
}
_RecordsetPtr pRecordSet;
_bstr_t strSQL;
strSQL = "SELECT 编号,名称,类型,所属区域,地址,坐标,描述 FROM 重点目标 WHERE 编号<>"+bstrID+" and 名称 = '" + bstrName+"'";
pRecordSet = theBllApp.m_pDB->ExcuteSqlRes(strSQL,adCmdText);
if (pRecordSet!=NULL && !pRecordSet->adoEOF)
return FALSE;
pRecordSet->Close();
pRecordSet.Release();
return TRUE;
}
示例4: HandleOpenByFileName
void CDocument::HandleOpenByFileName(const CStdString& sDocumentFileName, const _bstr_t& openPassword, const _bstr_t& modifyPassword, const _bstr_t& unrestrictPassword)
{
LOG_WS_FUNCTION_SCOPE();
if(!PathFileExists(sDocumentFileName.c_str()))
throw Workshare::System::IO::FileNotFoundException(sDocumentFileName, _T("The document could not be opened because it doesn't exist or has an invalid name."));
WSFileFormat::IFileTypeCheckerPtr spFileTypeChecker;
HRESULT hr = spFileTypeChecker.CreateInstance(_T("WSFileFormat.FileTypeChecker"));
if (FAILED(hr))
{
if (REGDB_E_CLASSNOTREG == hr)
{
throw Workshare::ClassNotFoundException(_T("WSFileFormat.FileTypeChecker"), _T("Failed to create an instance of CFileTypeChecker when opening document by filename."));
}
throw Workshare::Com::ComException(_T("Failed to create an instance of CFileTypeChecker when opening document by filename."), hr);
}
IMWApplication* pApplication = 0;
hr = m_pApplication->QueryInterface(__uuidof(IMWApplication), reinterpret_cast<void**>(&pApplication));
if(FAILED(hr))
throw Workshare::Com::ComException(_T("Failed to query an IMWApplication instance from the internal application object"), hr, m_pApplication);
IMWApplicationPtr spApplication(pApplication, false);
int fileType = spFileTypeChecker->GetFileType(sDocumentFileName.c_str());
if(WSFileFormat::wsFileTypeWord == fileType)
{
if (FF_MS_WORD_6 >= spFileTypeChecker->GetFileFormat(sDocumentFileName.c_str()))
throw Workshare::FileFormatVersionNotSupportedException(sDocumentFileName.c_str(), _T("MS Word"), _T("Word 6.0/95"), _T("Encountered a word document version lower than or equal to Word95/6.0"));
}
SetCorrectDocumentType(fileType, sDocumentFileName.c_str(), spApplication);
//then we need to figure out what supported elements based on file type to pass down...
IMWMetadataElements* pSupportedElements = 0;
hr = m_pDocumentType->get_SupportedElements(&pSupportedElements);
if(FAILED(hr))
throw Workshare::Com::ComException(_T("Failed to obtain the file type's supported elements when opening document by filename."), hr, m_pDocumentType);
IMWMetadataElementsPtr spSupportedElements(pSupportedElements, false);
MetadataElementsConverter converter;
//we know the IMWMetadataElements are the same creature, but the converter uses the Metawall namespace and this project does #import "WPAPI.tlb" no_namespace
Workshare::Protect::MetadataElements supportedElements = converter.ConvertComElements(reinterpret_cast<Metawall::IMWMetadataElements*>(spSupportedElements.GetInterfacePtr()));
SetupImplementorsWithSupportedElements(fileType, supportedElements, sDocumentFileName.c_str());
if(m_spImplementor.get() == 0)
throw Workshare::OutOfMemoryException(_T("Failed to initialize the implementor"));
m_spImplementor->SetFileFormat(spFileTypeChecker->GetFileType(sDocumentFileName.c_str()));
if(openPassword.length() > 0 || modifyPassword.length() > 0 || unrestrictPassword.length() > 0)
m_spImplementor->Open(sDocumentFileName, static_cast<const wchar_t*>(openPassword), static_cast<const wchar_t*>(modifyPassword), static_cast<const wchar_t*>(unrestrictPassword));
else
m_spImplementor->Open(sDocumentFileName);
}
示例5: _LoadObject
HRESULT CTCPropBagOnRegKey::_LoadObject(const _bstr_t& strName,
IUnknown* punkObj, IErrorLog* pErrorLog)
{
// Validate the specified parameters
if (IsBadReadPtr(punkObj))
return E_POINTER;
if (NULL != pErrorLog && IsBadReadPtr(pErrorLog))
return E_POINTER;
// Open the subkey with the specified name
CRegKey subkey;
if (!strName.length())
subkey = m_key;
else if (!m_key.Exists(strName) || !subkey.Open(m_key, strName))
return HRESULT_FROM_WIN32(GetLastError());
// QueryInterface for IPersistPropertyBag
IPersistPropertyBagPtr pppb;
HRESULT hr = punkObj->QueryInterface(__uuidof(pppb), (void**)&pppb);
if (FAILED(hr))
return hr;
// Load the object's persistent properties
CComObjectStack<CTCPropBagOnRegKey> bag;
bag.Init(subkey, strName, this);
hr = pppb->Load(&bag, pErrorLog);
// Return the last HRESULT
return hr;
}
示例6: LoadXml
bool CXmlDocument::LoadXml(const _bstr_t &xmlString)
{
if ( m_pDoc ==NULL )
Initialize();
ATLASSERT(m_pDoc!=NULL);
if(xmlString.length() == 0) return false;
if(m_pDoc->_loadXML(xmlString))
{
m_szUrl.Empty();
m_pNode = GetRoot();
//set default selection namespaces
CString cstr = GetNameSpaces();
if(!cstr.IsEmpty())
{
m_pDoc->_setProperty(_T("SelectionNamespaces"), (LPCTSTR)cstr);
}
return true;
}
else
{
m_szUrl.Empty();
m_pNode = NULL;
return false;
}
}
示例7:
//加载流行线节点列表
std::vector<string> CFloatRowLine::LoadNodesVetor( _bstr_t bstrID)
{
vector<string> coodinates;
if (bstrID.length()<=0)
{
MessageBox(NULL,_T("请选择要加载的流行线!"),_T("提示"),0);
return coodinates;
}
if (!theBllApp.m_bConntSuccess)
{
MessageBox(NULL,_T("数据库连接失败!"),_T("提示"),0);
return coodinates;
}
if (!theBllApp.m_pDB->CheckTableNameExist("流行线"))
{
MessageBox(NULL,_T("数据库中不存在该流行线业务表!"),_T("提示"),0);
return coodinates;
}
_RecordsetPtr prst=LoadNodesRCS(bstrID);
if (prst!=NULL)
{
_variant_t var;
while(!prst->adoEOF)
{
var=prst->GetCollect("坐标");
coodinates.push_back(((char *)((_bstr_t)(var.vt==1?"":var))));
prst->MoveNext();
}
prst->Close();
prst.Release();
}
return coodinates;
}
示例8: _SaveObject
HRESULT CTCPropBagOnRegKey::_SaveObject(const _bstr_t& strName,
IUnknown* punkObj, BOOL bClearDirty, BOOL bSaveAllProperties)
{
// Validate the specified parameters
if (IsBadReadPtr(punkObj))
return E_POINTER;
// Create a subkey with the specified name
CRegKey subkey;
if (!strName.length())
subkey = m_key;
else
{
m_key.DeleteValue(strName);
m_key.RecurseDeleteKey(strName);
if (!subkey.Open(m_key, strName))
return HRESULT_FROM_WIN32(GetLastError());
}
// QueryInterface for IPersistPropertyBag
IPersistPropertyBagPtr pppb;
HRESULT hr = punkObj->QueryInterface(__uuidof(pppb), (void**)&pppb);
if (FAILED(hr))
return hr;
// Get the object's CLSID
CLSID clsid;
hr = pppb->GetClassID(&clsid);
if (FAILED(hr))
return hr;
// Attempt first to convert the object's CLSID to a ProgID
LPOLESTR pszProgID = NULL;
if (SUCCEEDED(ProgIDFromCLSID(clsid, &pszProgID)))
{
subkey.WriteString(m_szProgID, pszProgID);
CoTaskMemFree(pszProgID);
}
else
{
// Convert the object's CLSID to a string
OLECHAR szClassID[64];
StringFromGUID2(clsid, szClassID, sizeofArray(szClassID));
subkey.WriteString(m_szCLSID, szClassID);
}
// Write the variant type value
subkey.WriteDWord(m_szVariantType, DWORD(VarTypeFromUnknown(punkObj)));
// Save the persistent properties of the object
CComObjectStack<CTCPropBagOnRegKey> bag;
bag.Init(subkey, strName, this);
hr = pppb->Save(&bag, bClearDirty, bSaveAllProperties);
// Return the last HRESULT
return hr;
}
示例9: _GetObjectCLSID
HRESULT CTCPropBagOnRegKey::_GetObjectCLSID(const _bstr_t& strName,
CLSID& clsid, CRegKey& subkey, _bstr_t& strObjectID, IErrorLog* pErrorLog)
{
USES_CONVERSION;
// Clear the specified clsid, subkey, and strObjectID parameters
clsid = CLSID_NULL;
subkey.Close();
strObjectID.Empty();
// Open the subkey with the specified name
if (!strName.length())
subkey = m_key;
else if (!m_key.Exists(strName) || !subkey.Open(m_key, strName))
return HRESULT_FROM_WIN32(GetLastError());
// Use local resources for string loading
MCLibRes res;
// Read the object's CLSID string value
HRESULT hr;
_bstr_t strDesc;
if (subkey.GetString(m_szCLSID, strObjectID))
{
// Convert the object's CLSID string to a CLSID
LPOLESTR pszObjectID = const_cast<LPOLESTR>(T2COLE(strObjectID));
hr = CLSIDFromString(pszObjectID, &clsid);
if (SUCCEEDED(hr))
return hr;
// Format an error description string
strDesc.Format(IDS_FMT_FAIL_CONVERT_CLSID, strObjectID);
}
else if (subkey.GetString(m_szProgID, strObjectID))
{
// Convert the object's ProgID string to a CLSID
hr = CLSIDFromProgID(T2COLE(strObjectID), &clsid);
if (SUCCEEDED(hr))
return hr;
// Format an error description string
strDesc.Format(IDS_FMT_FAIL_CONVERT_CLSID, strObjectID);
}
else
{
// Save the last error
hr = HRESULT_FROM_WIN32(GetLastError());
// Format an error description string
strDesc.LoadString(IDS_FAIL_READ_CLSID);
}
// Log the error and return
return LogError("GetObjectCLSID", strDesc, hr, T2COLE(strName), pErrorLog);
}
示例10: _CreateRemoteObject
HRESULT CTCPropBagOnRegKey::_CreateRemoteObject(const _bstr_t& strServer,
const _bstr_t& strName, IUnknown** ppunkObj, IErrorLog* pErrorLog)
{
// If DCOM is not installed, take appropriate action
MCOle32_dll& libOle32 = GetOle32Lib();
if (!libOle32.Exists_CoCreateInstanceEx())
return !strServer.length() ?
CreateLocalObject(strName, ppunkObj, pErrorLog) : E_UNEXPECTED;
// Read the CLSID of the object saved on the specified subkey
CLSID clsid;
CRegKey subkey;
_bstr_t strObjectID;
HRESULT hr = GetObjectCLSID(strName, clsid, subkey, strObjectID,
pErrorLog);
if (FAILED(hr))
return hr;
// Create the object
USES_CONVERSION;
_bstr_t bstrServer(strServer);
COSERVERINFO csi = {0, bstrServer, NULL, 0};
MULTI_QI mqi = {&IID_IPersistPropertyBag, NULL, 0};
DWORD dwCtx = CLSCTX_ALL | CLSCTX_REMOTE_SERVER;
hr = libOle32.CoCreateInstanceEx(clsid, NULL, dwCtx, &csi, 1, &mqi);
if (FAILED(hr))
{
// Use local resources
MCLibRes res;
// Format a description string
_bstr_t strDesc;
strDesc.Format(IDS_FMT_FAIL_CREATE_CLSID, strObjectID);
// Log the error
USES_CONVERSION;
return LogError("CreateObject", strDesc, hr, T2COLE(strName), pErrorLog);
}
// Attach the interface pointer to the smart pointer
IPersistPropertyBagPtr pppb((IPersistPropertyBag*)mqi.pItf, false);
// Load the object's persistent properties
CComObjectStack<CTCPropBagOnRegKey> bag;
bag.Init(subkey, strName, this);
hr = pppb->Load(&bag, pErrorLog);
if (FAILED(hr))
return hr;
// Detach the IUnknown* and copy to the [out] parameter, don't Release it
*ppunkObj = pppb.Detach();
// Indicate success
return S_OK;
}
示例11: Loadproperties
void CFloatRowLine::Loadproperties(_bstr_t bstrID, std::vector<string> &vecField, std::vector<string> &vecRecordSet, long &lFieldCounts)
{
if (bstrID.length()<=0)
{
MessageBox(NULL,_T("请选择要加载属性的流行线!"),_T("提示"),0);
return;
}
_RecordsetPtr res = Loadproperties(bstrID);
if(res==NULL)
return;
CBllHelp::Instance().QueryByCondit(res,vecField,vecRecordSet,lFieldCounts);
}
示例12: catch
Xml::Status::code Xml::Document::load (_bstr_t xmlDocumentFilename)
{
// see if there's an existing...
if (this->x_xmlDocument)
{
// delete the existing...
delete static_cast<ShellDocument *>(this->x_xmlDocument);
this->x_xmlDocument = 0;
}
if (xmlDocumentFilename.length () > 0)
{
// create a new dom shell...
if (this->x_xmlDocument = new ShellDocument ())
{
// load the document...
if (static_cast<ShellDocument *>(this->x_xmlDocument)->domDocument)
{
IXMLDOMNode *newDomNode;
// load the file or stream...
try
{
if (((wchar_t *)xmlDocumentFilename)[0] == '<')
{
newDomNode = static_cast<ShellDocument *>(this->x_xmlDocument)->loadXML (xmlDocumentFilename);
}
else
{
newDomNode = static_cast<ShellDocument *>(this->x_xmlDocument)->loadFile (xmlDocumentFilename);
}
}
catch (...)
{
// failed...
}
// validate the node...
if (newDomNode)
{
// copy to the root node...
if (DOMInterfaceCollections::copyNode (&this->rootNode,newDomNode))
{
// return success...
return static_cast<ShellDocument *>(this->x_xmlDocument)->status = Xml::Status::ready;
}
}
// failing load...
return static_cast<ShellDocument *>(this->x_xmlDocument)->status = Xml::Status::invalidDocument;
}
}
}
return static_cast<ShellDocument *>(this->x_xmlDocument)->status = Xml::Status::failed;
}
示例13: LoadInfo
//加载流行线信息
BOOL CFloatRowLine::LoadInfo( _bstr_t bstrID)
{
if (bstrID.length()<=0)
{
MessageBox(NULL,_T("请选择要加载的流行线!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_bConntSuccess)
{
MessageBox(NULL,_T("数据库连接失败!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_pDB->CheckTableNameExist("流行线"))
{
MessageBox(NULL,_T("数据库中不存在该流行线业务表!"),_T("提示"),0);
return FALSE;
}
_RecordsetPtr prstInfo = theBllApp.m_pDB->ExcuteSqlRes("select 编号,名称,所属目标,颜色,实线,箭头,宽度,创建人,创建时间,描述 from 流行线 where 编号="+bstrID,adCmdText);
BOOL bFlag=FALSE;
if (prstInfo!=NULL)
{
if (!prstInfo->adoEOF)
{
m_strID = bstrID ;
_variant_t var;
var=(prstInfo->GetCollect("名称")) ;
m_strName = (_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("所属目标")) ;
m_strToTarger=(_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("颜色")) ;
m_strColor=(_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("实线")) ;
m_strLineType=(_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("箭头")) ;
m_strDerection=(_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("宽度")) ;
m_strWidth=(_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("创建人")) ;
m_strCreator = (_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("创建时间")) ;
m_strCreateTime = (_bstr_t)(var.vt==1?"":var);
var=(prstInfo->GetCollect("描述")) ;
m_strRemark = (_bstr_t)(var.vt==1?"":var);
bFlag=TRUE;
}
prstInfo->Close();
prstInfo.Release();
}
return bFlag;
}
示例14: if
_bstr_t CTCPropBagOnRegKey::_GetServer(const _bstr_t& strName)
{
// Open the subkey with the specified name
CRegKey subkey;
if (!strName.length())
subkey = m_key;
else if (!m_key.Exists(strName) || !subkey.Open(m_key, strName))
return _bstr_t();
// Read the Server of the object saved on the specified subkey
_bstr_t strServer;
if (!subkey._GetString(m_szServer, strServer))
strServer.Empty();
return strServer;
}
示例15: LoadByName
BOOL CEmphasesTarget::LoadByName(_bstr_t bstrName)
{
if (bstrName.length()<=0)
{
MessageBox(NULL,_T("请选择要加载重点目标名称!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_bConntSuccess)
{
MessageBox(NULL,_T("数据库连接失败!"),_T("提示"),0);
return FALSE;
}
if (!theBllApp.m_pDB->CheckTableNameExist("重点目标"))
{
MessageBox(NULL,_T("数据库中不存在该重点目标业务表!"),_T("提示"),0);
return FALSE;
}
BOOL bFlag=FALSE;
_RecordsetPtr pRecordSet;
_bstr_t strSQL;
strSQL = "SELECT 编号,名称,类型,所属区域,地址,坐标,描述 FROM 重点目标 WHERE 名称 = '" + bstrName+"'";
pRecordSet = theBllApp.m_pDB->ExcuteSqlRes(strSQL,adCmdText);
if (pRecordSet!=NULL)
{
if (!pRecordSet->adoEOF)
{
_variant_t var;
var=pRecordSet->GetCollect("编号");
m_strID = (_bstr_t)(var.vt==1?"":var);
var=pRecordSet->GetCollect("名称");
m_strName = (_bstr_t)(var.vt==1?"":var);
var=pRecordSet->GetCollect("类型");
m_strType = (_bstr_t)(var.vt==1?"":var);
var=pRecordSet->GetCollect("所属区域");
m_strArea = (_bstr_t)(var.vt==1?"":var);
var=pRecordSet->GetCollect("地址");
m_strAddress = (_bstr_t)(var.vt==1?"":var);
var=pRecordSet->GetCollect("坐标");
m_strCoordinate = (_bstr_t)(var.vt==1?"":var);
var=pRecordSet->GetCollect("描述");
m_strRemark = (_bstr_t)(var.vt==1?"":var);
bFlag=TRUE;
}
pRecordSet->Close();
pRecordSet.Release();
}
return bFlag;
}