void QWinJumpListCategoryPrivate::loadRecents() { Q_ASSERT(jumpList); IApplicationDocumentLists *pDocList = 0; HRESULT hresult = CoCreateInstance(qCLSID_ApplicationDocumentLists, 0, CLSCTX_INPROC_SERVER, qIID_IApplicationDocumentLists, reinterpret_cast<void **>(&pDocList)); if (SUCCEEDED(hresult)) { if (!jumpList->identifier().isEmpty()) { wchar_t *id = qt_qstringToNullTerminated(jumpList->identifier()); hresult = pDocList->SetAppID(id); delete[] id; } if (SUCCEEDED(hresult)) { IObjectArray *array = 0; hresult = pDocList->GetList(type == QWinJumpListCategory::Recent ? ADLT_RECENT : ADLT_FREQUENT, 0, qIID_IObjectArray, reinterpret_cast<void **>(&array)); if (SUCCEEDED(hresult)) { items = QWinJumpListPrivate::fromComCollection(array); array->Release(); } } pDocList->Release(); } if (FAILED(hresult)) QWinJumpListPrivate::warning("loadRecents", hresult); }
// @pymethod |PyIApplicationDocumentLists|SetAppID|Specifies the application whose jump list is to be accessed // @comm This method is only needed if the application sets its own taskbar identifier PyObject *PyIApplicationDocumentLists::SetAppID(PyObject *self, PyObject *args) { IApplicationDocumentLists *pIADL = GetI(self); if ( pIADL == NULL ) return NULL; // @pyparm str|AppID||Taskbar identifier for the application PyObject *obappid; TmpWCHAR appid; if ( !PyArg_ParseTuple(args, "O:SetAppID", &obappid) ) return NULL; if (!PyWinObject_AsWCHAR(obappid, &appid, FALSE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIADL->SetAppID(appid); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIADL, IID_IApplicationDocumentLists ); Py_INCREF(Py_None); return Py_None; }
void wxTaskBarJumpListImpl::LoadKnownCategory(const wxString& title) { IApplicationDocumentLists *docList = 0; HRESULT hr = CoCreateInstance ( wxCLSID_ApplicationDocumentLists, NULL, CLSCTX_INPROC_SERVER, wxIID_IApplicationDocumentLists, reinterpret_cast<void **>(&docList) ); if ( FAILED(hr) ) { wxLogApiError("CoCreateInstance(wxCLSID_ApplicationDocumentLists)", hr); return; } if ( !m_appID.empty() ) docList->SetAppID(m_appID.wc_str()); IObjectArray *array = NULL; wxASSERT_MSG( title == "Recent" || title == "Frequent", "Invalid title." ); hr = docList->GetList ( title == "Recent" ? ADLT_RECENT : ADLT_FREQUENT, 0, wxIID_IObjectArray, reinterpret_cast<void **>(&array) ); if ( FAILED(hr) ) { wxLogApiError("IApplicationDocumentLists::GetList", hr); return; } UINT count = 0; array->GetCount(&count); for (UINT i = 0; i < count; ++i) { IUnknown *collectionItem = NULL; hr = array->GetAt(i, wxIID_IUnknown, reinterpret_cast<void **>(&collectionItem)); if ( FAILED(hr) ) { wxLogApiError("IObjectArray::GetAt", hr); continue; } IShellLink *shellLink = NULL; IShellItem *shellItem = NULL; wxTaskBarJumpListItem* item = NULL; if ( SUCCEEDED(collectionItem->QueryInterface( wxIID_IShellLink, reinterpret_cast<void**>(&shellLink))) ) { item = GetItemFromIShellLink(shellLink); shellLink->Release(); } else if ( SUCCEEDED(collectionItem->QueryInterface( wxIID_IShellItem, reinterpret_cast<void**>(&shellItem))) ) { item = GetItemFromIShellItem(shellItem); shellItem->Release(); } else { wxLogError("Can not query interfaces: IShellLink or IShellItem."); } if ( item ) { if ( title == wxT("Frequent") ) m_frequent->Append(item); else m_recent->Append(item); } collectionItem->Release(); } array->Release(); docList->Release(); }