本文整理汇总了C++中COMPtr::Next方法的典型用法代码示例。如果您正苦于以下问题:C++ COMPtr::Next方法的具体用法?C++ COMPtr::Next怎么用?C++ COMPtr::Next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COMPtr
的用法示例。
在下文中一共展示了COMPtr::Next方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Read
void COPropertySet::Read(IPropertySetStorage* pPropSetStg)
{ if( NULL!=pPropSetStg )
{ COMPtr<IPropertyStorage> pPropStg;
COMPtr<IEnumSTATPROPSTG> pEnum;
HRESULT hr = S_OK;
STATPROPSTG statpropstg;
PROPSPEC propSpec;
THROW_COMEXCEPTION( pPropSetStg->Open( m_fmtid, STGM_READ|STGM_SHARE_EXCLUSIVE,&pPropStg ) );
THROW_COMEXCEPTION( pPropStg->Enum( &pEnum ) );
statpropstg.lpwstrName = NULL;
hr = pEnum->Next( 1, &statpropstg, NULL );
THROW_COMEXCEPTION( hr );
for( ;S_OK==hr; )
{ COPropVariant propValue;
propSpec.ulKind = PRSPEC_PROPID;
propSpec.propid = statpropstg.propid;
const PROPVARIANT* p = propValue;
THROW_COMEXCEPTION( pPropStg->ReadMultiple( 1, &propSpec, const_cast<PROPVARIANT*>(p) ) );
PROPERTYMAP::iterator propIter = m_properties.find(propSpec.propid);
if( m_properties.empty() || propIter==m_properties.end() )
m_properties.insert( PROPERTYPAIR(propSpec.propid,propValue) );
else
propIter->second = propValue;
if( NULL!=statpropstg.lpwstrName )
AddPropertyName(propSpec.propid,statpropstg.lpwstrName);
statpropstg.lpwstrName = NULL;
hr = pEnum->Next( 1, &statpropstg, NULL );
THROW_COMEXCEPTION( hr );
} // of for
PROPID propid = PID_DICTIONARY;
if( NULL!=m_readFriendlySetName )
::CoTaskMemFree( m_readFriendlySetName );
TCHAR* pwszFriendlyName = NULL;
m_readFriendlySetName = NULL;
if( SUCCEEDED(pPropStg->ReadPropertyNames( 1, &propid, &m_readFriendlySetName)) )
m_friendlySetName = m_readFriendlySetName;
} // of if
} // of COPropertySet::Read()
示例2: while
// extensions beyond IE's API
HashSet<String> ClipboardWin::types() const
{
HashSet<String> results;
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
return results;
if (!m_dataObject)
return results;
COMPtr<IEnumFORMATETC> itr;
if (FAILED(m_dataObject->EnumFormatEtc(0, &itr)))
return results;
if (!itr)
return results;
FORMATETC data;
while (SUCCEEDED(itr->Next(1, &data, 0))) {
addMimeTypesForFormat(results, data);
}
return results;
}
示例3: hasData
bool ClipboardWin::hasData()
{
if (!m_dataObject && m_dragDataMap.isEmpty())
return false;
if (m_dataObject) {
COMPtr<IEnumFORMATETC> itr;
if (FAILED(m_dataObject->EnumFormatEtc(DATADIR_GET, &itr)))
return false;
if (!itr)
return false;
FORMATETC data;
// IEnumFORMATETC::Next returns S_FALSE if there are no more items.
if (itr->Next(1, &data, 0) == S_OK) {
// There is at least one item in the IDataObject
return true;
}
return false;
}
return !m_dragDataMap.isEmpty();
}
示例4: while
// extensions beyond IE's API
ListHashSet<String> ClipboardWin::types() const
{
ListHashSet<String> results;
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
return results;
if (!m_dataObject && m_dragDataMap.isEmpty())
return results;
if (m_dataObject) {
COMPtr<IEnumFORMATETC> itr;
if (FAILED(m_dataObject->EnumFormatEtc(DATADIR_GET, &itr)))
return results;
if (!itr)
return results;
FORMATETC data;
// IEnumFORMATETC::Next returns S_FALSE if there are no more items.
while (itr->Next(1, &data, 0) == S_OK)
addMimeTypesForFormat(results, data);
} else {
for (DragDataMap::const_iterator it = m_dragDataMap.begin(); it != m_dragDataMap.end(); ++it) {
FORMATETC data;
data.cfFormat = (*it).key;
addMimeTypesForFormat(results, data);
}
}
return results;
}
示例5: while
// extensions beyond IE's API
HashSet<String> ClipboardWin::types() const
{
HashSet<String> results;
if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)
return results;
if (!m_dataObject)
return results;
COMPtr<IEnumFORMATETC> itr;
if (FAILED(m_dataObject->EnumFormatEtc(DATADIR_GET, &itr)))
return results;
if (!itr)
return results;
FORMATETC data;
// IEnumFORMATETC::Next returns S_FALSE if there are no more items.
while (itr->Next(1, &data, 0) == S_OK) {
addMimeTypesForFormat(results, data);
}
return results;
}
示例6: checkGrammarOfString
void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector<GrammarDetail>& details, int* badGrammarLocation, int* badGrammarLength)
{
details.clear();
*badGrammarLocation = -1;
*badGrammarLength = 0;
COMPtr<IWebEditingDelegate> ed;
if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
return;
initViewSpecificSpelling(m_webView);
COMPtr<IEnumWebGrammarDetails> enumDetailsObj;
if (FAILED(ed->checkGrammarOfString(m_webView, text, length, &enumDetailsObj, badGrammarLocation, badGrammarLength)))
return;
while (true) {
ULONG fetched;
COMPtr<IWebGrammarDetail> detailObj;
if (enumDetailsObj->Next(1, &detailObj, &fetched) != S_OK)
break;
GrammarDetail detail;
if (FAILED(detailObj->length(&detail.length)))
continue;
if (FAILED(detailObj->location(&detail.location)))
continue;
BSTR userDesc;
if (FAILED(detailObj->userDescription(&userDesc)))
continue;
detail.userDescription = String(userDesc, SysStringLen(userDesc));
SysFreeString(userDesc);
COMPtr<IEnumSpellingGuesses> enumGuessesObj;
if (FAILED(detailObj->guesses(&enumGuessesObj)))
continue;
while (true) {
BSTR guess;
if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
break;
detail.guesses.append(String(guess, SysStringLen(guess)));
SysFreeString(guess);
}
details.append(detail);
}
}
示例7: dumpFramesAsText
static wstring dumpFramesAsText(IWebFrame* frame)
{
if (!frame)
return L"";
COMPtr<IDOMDocument> document;
if (FAILED(frame->DOMDocument(&document)))
return L"";
COMPtr<IDOMElement> documentElement;
if (FAILED(document->documentElement(&documentElement)))
return L"";
wstring result;
// Add header for all but the main frame.
COMPtr<IWebFrame> parent;
if (FAILED(frame->parentFrame(&parent)))
return L"";
if (parent) {
BSTR name = L"";
if (FAILED(frame->name(&name)))
return L"";
result.append(L"\n--------\nFrame: '");
result.append(name ? name : L"", SysStringLen(name));
result.append(L"'\n--------\n");
SysFreeString(name);
}
BSTR innerText = 0;
COMPtr<IDOMElementPrivate> docPrivate;
if (SUCCEEDED(documentElement->QueryInterface(&docPrivate)))
docPrivate->innerText(&innerText);
result.append(innerText ? innerText : L"", SysStringLen(innerText));
result.append(L"\n");
SysFreeString(innerText);
if (::gLayoutTestController->dumpChildFramesAsText()) {
COMPtr<IEnumVARIANT> enumKids;
if (FAILED(frame->childFrames(&enumKids)))
return L"";
VARIANT var;
VariantInit(&var);
while (enumKids->Next(1, &var, 0) == S_OK) {
ASSERT(V_VT(&var) == VT_UNKNOWN);
COMPtr<IWebFrame> framePtr;
V_UNKNOWN(&var)->QueryInterface(IID_IWebFrame, (void**)&framePtr);
result.append(dumpFramesAsText(framePtr.get()));
VariantClear(&var);
}
}
return result;
}
示例8: sizeof
basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& os, IPropertySetStorage *pPropSetStg)
{ COMPtr<IEnumSTATPROPSETSTG> penum;
HRESULT hr = S_OK;
STATPROPSETSTG statpropsetstg;
THROW_COMEXCEPTION( pPropSetStg->Enum( &penum ) );
::memset( &statpropsetstg, 0, sizeof(statpropsetstg) );
hr = penum->Next( 1, &statpropsetstg, NULL );
THROW_COMEXCEPTION( hr );
while( S_OK==hr )
{ { auto_ptr<COM::COPropertySet> pPropertySet(new COM::COPropertySet(statpropsetstg.fmtid));
pPropertySet->Read(pPropSetStg);
os<<*pPropertySet;
}
hr = penum->Next( 1, &statpropsetstg, NULL );
THROW_COMEXCEPTION( hr );
} // of while
try
{ auto_ptr<COM::COPropertySet> pPropertySet(new COM::COPropertySet(FMTID_UserDefinedProperties));
pPropertySet->Read(pPropSetStg);
os<<*pPropertySet;
}
catch(...)
{ }
return os;
} // of basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& os, IPropertySetStorage *pPropSetStg)
示例9: while
const DragDataMap& DragData::dragDataMap()
{
if (!m_dragDataMap.isEmpty() || !m_platformDragData)
return m_dragDataMap;
// Enumerate clipboard content and load it in the map.
COMPtr<IEnumFORMATETC> itr;
if (FAILED(m_platformDragData->EnumFormatEtc(DATADIR_GET, &itr)) || !itr)
return m_dragDataMap;
FORMATETC dataFormat;
while (itr->Next(1, &dataFormat, 0) == S_OK) {
Vector<String> dataStrings;
getClipboardData(m_platformDragData, &dataFormat, dataStrings);
if (!dataStrings.isEmpty())
m_dragDataMap.set(dataFormat.cfFormat, dataStrings);
}
return m_dragDataMap;
}
示例10: dumpFrameScrollPosition
void dumpFrameScrollPosition(IWebFrame* frame)
{
if (!frame)
return;
COMPtr<IWebFramePrivate> framePrivate;
if (FAILED(frame->QueryInterface(&framePrivate)))
return;
SIZE scrollPosition;
if (FAILED(framePrivate->scrollOffset(&scrollPosition)))
return;
if (abs(scrollPosition.cx) > 0.00000001 || abs(scrollPosition.cy) > 0.00000001) {
COMPtr<IWebFrame> parent;
if (FAILED(frame->parentFrame(&parent)))
return;
if (parent) {
BSTR name;
if (FAILED(frame->name(&name)))
return;
printf("frame '%S' ", name ? name : L"");
SysFreeString(name);
}
printf("scrolled to %.f,%.f\n", (double)scrollPosition.cx, (double)scrollPosition.cy);
}
if (::gLayoutTestController->dumpChildFrameScrollPositions()) {
COMPtr<IEnumVARIANT> enumKids;
if (FAILED(frame->childFrames(&enumKids)))
return;
VARIANT var;
VariantInit(&var);
while (enumKids->Next(1, &var, 0) == S_OK) {
ASSERT(V_VT(&var) == VT_UNKNOWN);
COMPtr<IWebFrame> framePtr;
V_UNKNOWN(&var)->QueryInterface(IID_IWebFrame, (void**)&framePtr);
dumpFrameScrollPosition(framePtr.get());
VariantClear(&var);
}
}
}
示例11: getGuessesForWord
void WebEditorClient::getGuessesForWord(const String& word, const String& context, const VisibleSelection&, Vector<String>& guesses)
{
guesses.clear();
COMPtr<IWebEditingDelegate> ed;
if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
return;
COMPtr<IEnumSpellingGuesses> enumGuessesObj;
if (FAILED(ed->guessesForWord(BString(word), &enumGuessesObj)))
return;
while (true) {
ULONG fetched;
BString guess;
if (enumGuessesObj->Next(1, &guess, &fetched) != S_OK)
break;
guesses.append(String(guess, SysStringLen(guess)));
}
}
示例12: hasData
bool ClipboardWin::hasData()
{
if (!m_dataObject)
return false;
COMPtr<IEnumFORMATETC> itr;
if (FAILED(m_dataObject->EnumFormatEtc(0, &itr)))
return false;
if (!itr)
return false;
FORMATETC data;
if (SUCCEEDED(itr->Next(1, &data, 0))) {
// There is at least one item in the IDataObject
return true;
}
return false;
}
示例13: name
LanguageManager::LanguageManager()
{
COMPtr<IMultiLanguage> multiLanguage;
if (FAILED(::CoCreateInstance(CLSID_CMultiLanguage, 0, CLSCTX_INPROC_SERVER, IID_IMultiLanguage, reinterpret_cast<LPVOID*>(&multiLanguage))))
return;
COMPtr<IEnumCodePage> enumInterface;
if (FAILED(multiLanguage->EnumCodePages(MIMECONTF_BROWSER, &enumInterface)))
return;
MIMECPINFO cpInfo;
ULONG ccpInfo;
while (SUCCEEDED(enumInterface->Next(1, &cpInfo, &ccpInfo)) && ccpInfo) {
if (!IsValidCodePage(cpInfo.uiCodePage))
continue;
HashMap<UINT, CString>::iterator i = codePageCharsets().find(cpInfo.uiCodePage);
CString name(String(cpInfo.wszWebCharset).latin1());
if (i == codePageCharsets().end()) {
CharsetInfo info;
info.m_codePage = cpInfo.uiCodePage;
knownCharsets().set(name.data(), info);
i = codePageCharsets().set(cpInfo.uiCodePage, name).iterator;
}
if (i != codePageCharsets().end()) {
HashMap<String, CharsetInfo>::iterator j = knownCharsets().find(String(i->value.data(), i->value.length()));
ASSERT(j != knownCharsets().end());
CharsetInfo& info = j->value;
info.m_name = i->value.data();
info.m_friendlyName = cpInfo.wszDescription;
info.m_aliases.append(name);
info.m_aliases.append(String(cpInfo.wszHeaderCharset).latin1());
info.m_aliases.append(String(cpInfo.wszBodyCharset).latin1());
String cpName = "cp" + String::number(cpInfo.uiCodePage);
info.m_aliases.append(cpName.latin1());
supportedCharsets().add(i->value.data());
}
}
}