本文整理汇总了C++中IServiceProvider::Release方法的典型用法代码示例。如果您正苦于以下问题:C++ IServiceProvider::Release方法的具体用法?C++ IServiceProvider::Release怎么用?C++ IServiceProvider::Release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServiceProvider
的用法示例。
在下文中一共展示了IServiceProvider::Release方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: versionSpecificInit
void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {
// Defaults.
this->shouldDisableTableHeaders = false;
this->hasEncodedAccDescription = false;
IServiceProvider* serv = NULL;
if (pacc->QueryInterface(IID_IServiceProvider, (void**)&serv) != S_OK)
return;
IAccessibleApplication* iaApp = NULL;
if (serv->QueryService(IID_IAccessibleApplication, IID_IAccessibleApplication, (void**)&iaApp) != S_OK) {
serv->Release();
return;
}
serv->Release();
BSTR toolkitName = NULL;
if (iaApp->get_toolkitName(&toolkitName) != S_OK) {
iaApp->Release();
return;
}
if(toolkitName) {
this->toolkitName = std::wstring(toolkitName, SysStringLen(toolkitName));
}
BSTR toolkitVersion = NULL;
if (iaApp->get_toolkitVersion(&toolkitVersion) != S_OK) {
iaApp->Release();
SysFreeString(toolkitName);
return;
}
iaApp->Release();
iaApp = NULL;
if (wcscmp(toolkitName, L"Gecko") == 0) {
if (wcsncmp(toolkitVersion, L"1.", 2) == 0) {
if (wcsncmp(toolkitVersion, L"1.9.2.", 6) == 0) {
// Gecko 1.9.2.x.
// Retrieve the digits for the final part of the main version number.
wstring verPart;
for (wchar_t* c = &toolkitVersion[6]; iswdigit(*c); c++)
verPart += *c;
if (_wtoi(verPart.c_str()) <= 10) {
// Gecko <= 1.9.2.10 will crash if we try to retrieve headers on some table cells, so disable them.
this->shouldDisableTableHeaders = true;
}
}
// Gecko 1.x uses accDescription to encode position info as well as the description.
this->hasEncodedAccDescription = true;
}
}
SysFreeString(toolkitName);
SysFreeString(toolkitVersion);
}
示例2: GetExplorerWindows
void GetExplorerWindows(std::vector<PairHwndPath>& windows, BOOL needPaths) {
IShellWindows *psw;
if(SUCCEEDED(CoCreateInstance(CLSID_ShellWindows, NULL, CLSCTX_ALL, IID_IShellWindows, (void**)&psw))) {
VARIANT v;
V_VT(&v) = VT_I4;
IDispatch* pdisp;
for(V_I4(&v) = 0; psw->Item(v, &pdisp) == S_OK; V_I4(&v)++) {
IWebBrowserApp *pwba;
if(SUCCEEDED(pdisp->QueryInterface(IID_IWebBrowserApp, (void**)&pwba))) {
PairHwndPath pair;
if(SUCCEEDED(pwba->get_HWND((LONG_PTR*)&pair.hwnd))) {
IServiceProvider *psp;
if(needPaths && SUCCEEDED(pwba->QueryInterface(IID_IServiceProvider, (void**)&psp))) {
IShellBrowser *psb;
if(SUCCEEDED(psp->QueryService(SID_STopLevelBrowser, IID_IShellBrowser, (void**)&psb))) {
IShellView *psv;
if(SUCCEEDED(psb->QueryActiveShellView(&psv))) {
IFolderView *pfv;
if(SUCCEEDED(psv->QueryInterface(IID_IFolderView, (void**)&pfv))) {
IPersistFolder2 *ppf2;
if(SUCCEEDED(pfv->GetFolder(IID_IPersistFolder2, (void**)&ppf2))) {
LPITEMIDLIST pidlFolder;
if(SUCCEEDED(ppf2->GetCurFolder(&pidlFolder))) {
if(!SHGetPathFromIDList(pidlFolder, pair.path)) {
IShellFolder* psf;
LPCITEMIDLIST pidlLast;
if(SUCCEEDED(SHBindToParent(pidlFolder, IID_IShellFolder, (void**)&psf, &pidlLast))) {
STRRET strret;
if(SUCCEEDED(psf->GetDisplayNameOf(pidlLast, 0x8000, &strret))) {
StrRetToBuf(&strret, pidlLast, pair.path, MAX_PATH);
}
else {
pair.path[0] = 0;
}
psf->Release();
}
}
CoTaskMemFree(pidlFolder);
}
ppf2->Release();
}
pfv->Release();
}
psv->Release();
}
psb->Release();
}
psp->Release();
}
windows.push_back(pair);
}
pwba->Release();
}
pdisp->Release();
}
psw->Release();
}
}
示例3: PopServiceProvider
void CRScriptCore::PopServiceProvider()
{
IServiceProvider* p = NULL;
s_crit.Lock();
if (m_listServiceProvider.size() > 0)
{
p = m_listServiceProvider.front();
m_listServiceProvider.pop_front();
}
s_crit.Unlock();
if (p)
p->Release();
}
示例4: getDocPagination
IPDDomDocPagination* getDocPagination(IAccessible* pacc, VARIANT& varChild) {
IServiceProvider* servProv;
if (pacc->QueryInterface(IID_IServiceProvider, (void**)&servProv) != S_OK)
return NULL;
IPDDomNode* domNode = getPDDomNode(varChild, servProv);
servProv->Release();
if (!domNode)
return NULL;
IPDDomDocPagination* ret;
if (domNode->QueryInterface(IID_IPDDomDocPagination, (void**)&ret) != S_OK)
ret = NULL;
domNode->Release();
return ret;
}
示例5: GetVirtualDesktopManager
HRESULT GetVirtualDesktopManager(IVirtualDesktopManagerInternal** ppDesktopManagerInternal)
{
::CoInitializeEx(NULL, COINIT_MULTITHREADED);
IServiceProvider* pServiceProvider = nullptr;
HRESULT hr = ::CoCreateInstance(
CLSID_ImmersiveShell, NULL, CLSCTX_LOCAL_SERVER,
__uuidof(IServiceProvider), (PVOID*)&pServiceProvider);
if (SUCCEEDED(hr))
{
hr = pServiceProvider->QueryService(CLSID_VirtualDesktopAPI_Unknown, ppDesktopManagerInternal);
pServiceProvider->Release();
}
return hr;
}
示例6: Cstr_message
void
ieambulant_display_message(int level, const char* message) {
USES_CONVERSION;
HRESULT hr = E_FAIL;
if ( ! s_site)
return;
IServiceProvider* pISP = NULL;
hr = s_site->QueryInterface(IID_IServiceProvider, (void **)&pISP);
if ( ! SUCCEEDED(hr))
return;
// get IWebBrowser2
IWebBrowser2* pIWebBrowser2 = NULL;
hr = pISP->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void **)&pIWebBrowser2);
pISP->Release();
if ( ! SUCCEEDED(hr) || pIWebBrowser2 == NULL)
return;
IDispatch *pIDispatchDocument = NULL;
hr = pIWebBrowser2->get_Document(&pIDispatchDocument);
pIWebBrowser2->Release();
if ( ! SUCCEEDED(hr) || pIDispatchDocument == NULL)
return;
// get IHTMLDocument2
IHTMLDocument2* pIHTMLDocument2 = NULL;
hr = pIDispatchDocument->QueryInterface(IID_IHTMLDocument2, (void **)&pIHTMLDocument2);
pIDispatchDocument->Release();
if ( ! SUCCEEDED(hr) || pIHTMLDocument2 == NULL)
return;
// get IHTMLWindow2
IHTMLWindow2* pIHTMLWindow2 = NULL;
hr = pIHTMLDocument2->get_parentWindow(&pIHTMLWindow2);
pIHTMLDocument2->Release();
if ( ! SUCCEEDED(hr) || pIHTMLWindow2 == NULL)
return;
CString Cstr_message(message);
BSTR BSTR_message = Cstr_message.AllocSysString();
pIHTMLWindow2->put_status(BSTR_message);
SysFreeString(BSTR_message);
pIHTMLWindow2->Release();
}
示例7: PyCom_BuildPyException
// @pymethod <o PyIInternetSecurityManager>|internet|CoInternetCreateSecurityManager|
static PyObject *PyCoInternetCreateSecurityManager(PyObject *self, PyObject *args)
{
CHECK_IE_PFN(CoInternetCreateSecurityManager);
PyObject *obprov;
DWORD reserved;
if (!PyArg_ParseTuple(args, "Oi",
&obprov, // &pyparm <o PyIServiceProvider>|serviceProvider||
&reserved)) // @pyparm int|reserved||
return NULL;
IServiceProvider *prov;
if (!PyCom_InterfaceFromPyInstanceOrObject(obprov, IID_IServiceProvider, (void **)&prov, TRUE /* bNoneOK */))
return NULL;
HRESULT hr;
IInternetSecurityManager *sm = 0;
PY_INTERFACE_PRECALL;
hr = (*pfnCoInternetCreateSecurityManager)(prov, &sm, reserved);
prov->Release();
PY_INTERFACE_POSTCALL;
if (FAILED(hr))
return PyCom_BuildPyException(hr);
return PyCom_PyObjectFromIUnknown(sm, IID_IInternetSecurityManager, FALSE);
}
示例8: saveSnapshot
//.........这里部分代码省略.........
ie = GetAncestor(hwndBrowser, GA_ROOTOWNER);
CComPtr<IDispatch> spDispatch;
hr = spBrowser->get_Document(&spDispatch);
if (FAILED(hr))
return E_FAIL;
spDocument = spDispatch;
if (spDocument == NULL)
return E_FAIL;
IServiceProvider* pServiceProvider = NULL;
if (SUCCEEDED(spBrowser->QueryInterface(
IID_IServiceProvider,
(void**)&pServiceProvider)))
{
IOleWindow* pWindow = NULL;
if (SUCCEEDED(pServiceProvider->QueryService(
SID_SShellBrowser,
IID_IOleWindow,
(void**)&pWindow)))
{
if (SUCCEEDED(pWindow->GetWindow(&hwndBrowser)))
{
hwndBrowser = FindWindowEx(hwndBrowser, NULL, _T("Shell DocObject View"), NULL);
if (hwndBrowser)
{
hwndBrowser = FindWindowEx(hwndBrowser, NULL, _T("Internet Explorer_Server"), NULL);
}
}
pWindow->Release();
}
pServiceProvider->Release();
}
}
// Nobody else seems to know how to get IViewObject2?!
// http://starkravingfinkle.org/blog/2004/09/
spViewObject = spDocument;
if (spViewObject == NULL)
{
Error(L"Unable to convert document to view object.");
return E_FAIL;
}
CComQIPtr<IHTMLDocument5> spDocument5;
spDocument->QueryInterface(IID_IHTMLDocument5, (void**)&spDocument5);
if (spDocument5 == NULL)
{
Error(L"Snapsie requires IE6 or greater.");
return E_FAIL;
}
CComBSTR compatMode;
spDocument5->get_compatMode(&compatMode);
// In non-standards-compliant mode, the BODY element represents the canvas.
if (compatMode == L"BackCompat")
{
CComPtr<IHTMLElement> spBody;
spDocument->get_body(&spBody);
if (NULL == spBody)
示例9: AdobeAcrobatVBufStorage_controlFieldNode_t
AdobeAcrobatVBufStorage_controlFieldNode_t* AdobeAcrobatVBufBackend_t::fillVBuf(int docHandle, IAccessible* pacc, VBufStorage_buffer_t* buffer,
AdobeAcrobatVBufStorage_controlFieldNode_t* parentNode, VBufStorage_fieldNode_t* previousNode,
AdobeAcrobatVBufStorage_controlFieldNode_t* oldNode,
TableInfo* tableInfo, wstring* pageNum
) {
int res;
LOG_DEBUG(L"Entered fillVBuf, with pacc at "<<pacc<<L", parentNode at "<<parentNode<<L", previousNode "<<previousNode);
nhAssert(buffer); //buffer can't be NULL
nhAssert(!parentNode||buffer->isNodeInBuffer(parentNode)); //parent node must be in buffer
nhAssert(!previousNode||buffer->isNodeInBuffer(previousNode)); //Previous node must be in buffer
VBufStorage_fieldNode_t* tempNode;
//all IAccessible methods take a variant for childID, get one ready
VARIANT varChild;
varChild.vt=VT_I4;
varChild.lVal=0;
IServiceProvider* servprov = NULL;
LOG_DEBUG(L"calling IAccessible::QueryInterface with IID_IServiceProvider");
if((res=pacc->QueryInterface(IID_IServiceProvider,(void**)(&servprov)))!=S_OK) {
LOG_DEBUG(L"IAccessible::QueryInterface returned "<<res);
return NULL;
}
LOG_DEBUG(L"IServiceProvider at "<<servprov);
// GET ID
int ID = getAccID(servprov);
nhAssert(ID);
//Make sure that we don't already know about this object -- protect from loops
if(buffer->getControlFieldNodeWithIdentifier(docHandle,ID)!=NULL) {
LOG_DEBUG(L"A node with this docHandle and ID already exists, returning NULL");
servprov->Release();
return NULL;
}
//Add this node to the buffer
LOG_DEBUG(L"Adding Node to buffer");
AdobeAcrobatVBufStorage_controlFieldNode_t* oldParentNode = parentNode;
parentNode = static_cast<AdobeAcrobatVBufStorage_controlFieldNode_t*>(buffer->addControlFieldNode(parentNode, previousNode,
new AdobeAcrobatVBufStorage_controlFieldNode_t(docHandle, ID, true)));
nhAssert(parentNode); //new node must have been created
previousNode=NULL;
LOG_DEBUG(L"Added node at "<<parentNode);
// Get role with accRole
long role = 0;
LOG_DEBUG(L"Get role with accRole");
{
wostringstream s;
VARIANT varRole;
VariantInit(&varRole);
if((res=pacc->get_accRole(varChild,&varRole))!=S_OK) {
LOG_DEBUG(L"accRole returned code "<<res);
s<<0;
} else if(varRole.vt==VT_BSTR) {
LOG_DEBUG(L"Got role string of " << varRole.bstrVal);
s << varRole.bstrVal;
} else if(varRole.vt==VT_I4) {
LOG_DEBUG(L"Got role of " << varRole.lVal);
s << varRole.lVal;
role = varRole.lVal;
}
parentNode->addAttribute(L"IAccessible::role",s.str().c_str());
VariantClear(&varRole);
}
// Get states with accState
LOG_DEBUG(L"get states with IAccessible::get_accState");
varChild.lVal=0;
VARIANT varState;
VariantInit(&varState);
if((res=pacc->get_accState(varChild,&varState))!=S_OK) {
LOG_DEBUG(L"pacc->get_accState returned "<<res);
varState.vt=VT_I4;
varState.lVal=0;
}
int states=varState.lVal;
VariantClear(&varState);
LOG_DEBUG(L"states is "<<states);
//Add each state that is on, as an attrib
for(int i=0;i<32;++i) {
int state=1<<i;
if(state&states) {
wostringstream nameStream;
nameStream<<L"IAccessible::state_"<<state;
parentNode->addAttribute(nameStream.str().c_str(),L"1");
}
}
IPDDomNode* domNode = getPDDomNode(varChild, servprov);
IPDDomElement* domElement = NULL;
LOG_DEBUG(L"Trying to get IPDDomElement");
if (domNode && (res = domNode->QueryInterface(IID_IPDDomElement, (void**)(&domElement))) != S_OK) {
LOG_DEBUG(L"QueryInterface to IPDDomElement returned " << res);
domElement = NULL;
}
BSTR stdName = NULL;
//.........这里部分代码省略.........
示例10: FindPaths
bool CDeskBand::FindPaths()
{
m_currentDirectory.clear();
m_selectedItems.clear();
m_bFilesSelected = false;
m_bFolderSelected = false;
if (m_pSite == NULL)
return false;
IServiceProvider * pServiceProvider;
if (SUCCEEDED(m_pSite->QueryInterface(IID_IServiceProvider, (LPVOID*)&pServiceProvider)))
{
IShellBrowser * pShellBrowser;
if (SUCCEEDED(pServiceProvider->QueryService(SID_SShellBrowser, IID_IShellBrowser, (LPVOID*)&pShellBrowser)))
{
IShellView * pShellView;
if (SUCCEEDED(pShellBrowser->QueryActiveShellView(&pShellView)))
{
IFolderView * pFolderView;
if (SUCCEEDED(pShellView->QueryInterface(IID_IFolderView, (LPVOID*)&pFolderView)))
{
// hooray! we got the IFolderView interface!
// that means the explorer is active and well :)
// but we also need the IShellFolder interface because
// we need its GetCurFolder() method
IPersistFolder2 * pPersistFolder;
if (SUCCEEDED(pFolderView->GetFolder(IID_IPersistFolder2, (LPVOID*)&pPersistFolder)))
{
LPITEMIDLIST folderpidl;
if (SUCCEEDED(pPersistFolder->GetCurFolder(&folderpidl)))
{
// we have the current folder
TCHAR buf[MAX_PATH] = {0};
// find the path of the folder
if (SHGetPathFromIDList(folderpidl, buf))
{
m_currentDirectory = buf;
}
// if m_currentDirectory is empty here, that means
// the current directory is a virtual path
IShellFolder * pShellFolder;
if (SUCCEEDED(pPersistFolder->QueryInterface(IID_IShellFolder, (LPVOID*)&pShellFolder)))
{
// if there was a new folder created but not found to set into editing mode,
// we try here to do that
if (!m_newfolderPidls.empty())
{
int nCount2 = 0;
IShellFolder * pShellFolder;
if (SUCCEEDED(pPersistFolder->QueryInterface(IID_IShellFolder, (LPVOID*)&pShellFolder)))
{
if (SUCCEEDED(pFolderView->ItemCount(SVGIO_ALLVIEW, &nCount2)))
{
for (int i=0; i<nCount2; ++i)
{
LPITEMIDLIST pidl;
pFolderView->Item(i, &pidl);
bool bFound = false;
for (std::vector<LPITEMIDLIST>::iterator it = m_newfolderPidls.begin(); it != m_newfolderPidls.end(); ++it)
{
HRESULT hr = pShellFolder->CompareIDs(0, pidl, *it);
if (HRESULT_CODE(hr) == 0)
{
// this item was there before, so it's not the new folder
CoTaskMemFree(*it);
m_newfolderPidls.erase(it);
bFound = true;
break;
}
}
if (!bFound)
{
pShellView->SelectItem(pidl, SVSI_EDIT);
}
CoTaskMemFree(pidl);
}
}
if ((nCount2)||(m_newfolderTimeoutCounter-- <= 0))
{
m_newfolderTimeoutCounter = 0;
for (std::vector<LPITEMIDLIST>::iterator it = m_newfolderPidls.begin(); it != m_newfolderPidls.end(); ++it)
{
CoTaskMemFree(*it);
}
m_newfolderPidls.clear();
}
pShellFolder->Release();
}
}
// find all selected items
IEnumIDList * pEnum;
if (SUCCEEDED(pFolderView->Items(SVGIO_SELECTION, IID_IEnumIDList, (LPVOID*)&pEnum)))
{
LPITEMIDLIST pidl;
WCHAR buf[MAX_PATH] = {0};
ULONG fetched = 0;
ULONG attribs = 0;
//.........这里部分代码省略.........
示例11: Rename
//.........这里部分代码省略.........
{
pidl = NULL;
if (SUCCEEDED(pEnum->Next(1, &pidl, &fetched)))
{
if (fetched)
{
// the pidl we get here is relative!
attribs = SFGAO_FILESYSTEM|SFGAO_FOLDER;
if (SUCCEEDED(pShellFolder->GetAttributesOf(1, (LPCITEMIDLIST*)&pidl, &attribs)))
{
if (attribs & SFGAO_FILESYSTEM)
{
// create an absolute pidl with the pidl we got above
LPITEMIDLIST abspidl = CPidl::Append(folderpidl, pidl);
if (abspidl)
{
if (SHGetPathFromIDList(abspidl, buf))
{
std::wstring p = buf;
size_t pos = p.find_last_of('\\');
if (pos != std::wstring::npos)
{
m_filelist.insert(p.substr(pos+1));
}
}
CoTaskMemFree(abspidl);
}
}
}
}
CoTaskMemFree(pidl);
}
} while(fetched);
pEnum->Release();
}
pShellFolder->Release();
}
CoTaskMemFree(folderpidl);
}
pPersistFolder->Release();
}
pFolderView->Release();
}
pShellView->Release();
}
pShellBrowser->Release();
}
pServiceProvider->Release();
}
}
// show the rename dialog
m_bDialogShown = TRUE;
CRenameDlg dlg(hwnd);
dlg.SetFileList(m_filelist);
if (dlg.DoModal(g_hInst, IDD_RENAMEDLG, hwnd, NULL) == IDOK)
{
try
{
const std::tr1::wregex regCheck(dlg.GetMatchString(), dlg.GetRegexFlags());
NumberReplaceHandler handler(dlg.GetReplaceString());
// start renaming the files
IServiceProvider * pServiceProvider = NULL;
if (SUCCEEDED(GetIServiceProvider(hwnd, &pServiceProvider)))
{
示例12: AfxGetStaticModuleState
STDMETHODIMP ExplorerBar::SetSite( IUnknown *inPunkSite )
{
AFX_MANAGE_STATE( AfxGetStaticModuleState() );
HRESULT err;
// Release the old interfaces.
if( mWebBrowser )
{
mWebBrowser->Release();
mWebBrowser = NULL;
}
if( mSite )
{
mSite->Release();
mSite = NULL;
}
// A non-NULL site means we're setting the site. Otherwise, the site is being released (done above).
if( !inPunkSite )
{
err = S_OK;
goto exit;
}
// Get the parent window.
IOleWindow * oleWindow;
mParentWindow = NULL;
err = inPunkSite->QueryInterface( IID_IOleWindow, (LPVOID *) &oleWindow );
require( SUCCEEDED( err ), exit );
err = oleWindow->GetWindow( &mParentWindow );
oleWindow->Release();
require_noerr( err, exit );
require_action( mParentWindow, exit, err = E_FAIL );
// Get the IInputObject interface.
err = inPunkSite->QueryInterface( IID_IInputObjectSite, (LPVOID *) &mSite );
require( SUCCEEDED( err ), exit );
check( mSite );
// Get the IWebBrowser2 interface.
IOleCommandTarget * oleCommandTarget;
err = inPunkSite->QueryInterface( IID_IOleCommandTarget, (LPVOID *) &oleCommandTarget );
require( SUCCEEDED( err ), exit );
IServiceProvider * serviceProvider;
err = oleCommandTarget->QueryInterface( IID_IServiceProvider, (LPVOID *) &serviceProvider );
oleCommandTarget->Release();
require( SUCCEEDED( err ), exit );
err = serviceProvider->QueryService( SID_SWebBrowserApp, IID_IWebBrowser2, (LPVOID *) &mWebBrowser );
serviceProvider->Release();
require( SUCCEEDED( err ), exit );
// Create the main window.
err = SetupWindow();
require_noerr( err, exit );
exit:
return( err );
}
示例13: HandleNoRightsEx
HRESULT HandleNoRightsEx( HRESULT hrStatus, WM_GET_LICENSE_DATA * pLicenseData )
{
HRESULT hr = S_OK;
BOOL fMonitoring = FALSE;
BSTR bstrURL = NULL;
if((NULL == pLicenseData) || (NULL == pLicenseData->wszLocalFilename))
{
return E_INVALIDARG;
}
if (FAILED(hrStatus) && (NS_E_DRM_NO_RIGHTS != hrStatus))
{
Msg(TEXT("Unable to obtain proper license!! Aborting playback...\r\n"));
hr = hrStatus;
return hr;
}
if( TRUE )
{
IServiceProvider *pServiceProvider;
JIF(g_pReader->QueryInterface(IID_IServiceProvider, (void **) &pServiceProvider));
JIF(pServiceProvider->QueryService(IID_IWMDRMReader, IID_IWMDRMReader,
(void **) &g_pDRMReader));
pServiceProvider->Release();
// do silent license acquisition
hr = g_pDRMReader->AcquireLicense(TRUE);
if (FAILED(hr))
{
Msg(TEXT("AcquireLicense Failed! hr=0x%x\n"), hr);
SAFE_RELEASE(g_pDRMReader);
return hr;
}
}
else // non-silent acquisition
{
// convert wszs to bstrs so we can pass them to core
bstrURL = SysAllocString(pLicenseData->wszLocalFilename);
if (!bstrURL)
{
hr = E_OUTOFMEMORY;
}
else
{
// start license monitoring
hr = g_pDRMReader->MonitorLicenseAcquisition();
if (FAILED(hr))
{
// wmp explicitly ignores hr here
g_pDRMReader->CancelMonitorLicenseAcquisition();
}
else
{
fMonitoring = true;
}
SysFreeString(bstrURL);
}
}
SAFE_RELEASE(g_pDRMReader);
return hr;
}
示例14: Filter
//.........这里部分代码省略.........
{
// force the filter to lowercase
TCHAR * pString = filter;
while (*pString)
{
*pString = _totlower(*pString);
pString++;
}
}
int nCount = 0;
if (SUCCEEDED(pFolderView->ItemCount(SVGIO_ALLVIEW, &nCount)))
{
pShellFolderView->SetRedraw(FALSE);
HWND listView = GetListView32(pShellView);
LRESULT viewType = 0;
if (listView)
{
// inserting items in the list view if the list view is set to
// e.g., LV_VIEW_LIST is painfully slow. So save the current view
// and set it to LV_VIEW_DETAILS (which is much faster for inserting)
// and restore the view after we're done.
viewType = SendMessage(listView, LVM_GETVIEW, 0, 0);
SendMessage(listView, LVM_SETVIEW, LV_VIEW_DETAILS, 0);
}
std::vector<LPITEMIDLIST> noShows;
for (int i=0; i<nCount; ++i)
{
LPITEMIDLIST pidl;
if (SUCCEEDED(pFolderView->Item(i, &pidl)))
{
if (CheckDisplayName(pShellFolder, pidl, filter, bUseRegex))
{
// remove now shown items which are in the no-show list
// this is necessary since we don't get a notification
// if the shell refreshes its view
for (std::vector<LPITEMIDLIST>::iterator it = m_noShows.begin(); it != m_noShows.end(); ++it )
{
if (HRESULT_CODE(pShellFolder->CompareIDs(SHCIDS_CANONICALONLY, *it, pidl))==0)
{
m_noShows.erase(it);
break;
}
}
CoTaskMemFree(pidl);
}
else
{
UINT puItem = 0;
if (pShellFolderView->RemoveObject(pidl, &puItem) == S_OK)
{
i--;
nCount--;
noShows.push_back(pidl);
}
}
}
}
// now add all those items again which were removed by a previous filter string
// but don't match this new one
//pShellFolderView->SetObjectCount(5000, SFVSOC_INVALIDATE_ALL|SFVSOC_NOSCROLL);
for (size_t i=0; i<m_noShows.size(); ++i)
{
LPITEMIDLIST pidlNoShow = m_noShows[i];
if (CheckDisplayName(pShellFolder, pidlNoShow, filter, bUseRegex))
{
m_noShows.erase(m_noShows.begin() + i);
i--;
UINT puItem = (UINT)i;
pShellFolderView->AddObject(pidlNoShow, &puItem);
CoTaskMemFree(pidlNoShow);
}
}
for (size_t i=0; i<noShows.size(); ++i)
{
m_noShows.push_back(noShows[i]);
}
if (listView)
{
SendMessage(listView, LVM_SETVIEW, viewType, 0);
}
pShellFolderView->SetRedraw(TRUE);
}
pShellFolder->Release();
}
pPersistFolder->Release();
}
pShellFolderView->Release();
}
pFolderView->Release();
}
pShellView->Release();
}
pShellBrowser->Release();
}
pServiceProvider->Release();
}
return bReturn;
}