Exemplo n.º 1
0
bool wxTaskBarJumpListImpl::BeginUpdate()
{
    if ( m_destinationList == NULL )
        return false;

    unsigned int max_count = 0;
    HRESULT hr = m_destinationList->BeginList(&max_count,
        wxIID_IObjectArray, reinterpret_cast<void**>(&(m_objectArray)));
    if ( !m_appID.empty() )
        m_destinationList->SetAppID(m_appID.wc_str());

    return SUCCEEDED(hr);
}
// Builds a new custom Jump List for this application.
void CreateJumpList()
{
    // Create the custom Jump List object.
    ICustomDestinationList *pcdl;
    HRESULT hr = CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pcdl));
    if (SUCCEEDED(hr))
    {
        // Custom Jump Lists follow a push model - applications are responsible for providing an updated
        // list anytime the contents should be changed.  Lists are generated in a list-building
        // transaction that starts by calling BeginList.  Until the list is committed, Windows will
        // display the previous version of the list, if available.
        //
        // The cMinSlots out parameter indicates the minimum number of items that the Jump List UI is
        // guaranteed to display.  Applications can provide more items when building a custom Jump List,
        // but the extra items may not be displayed.  The number is dependant upon a number of factors,
        // such as screen resolution and the "Number of recent items to display in Jump Lists" user setting.
        // See the MSDN documentation on BeginList for more information.
        //
        // The IObjectArray returned from BeginList contains a list of items the user has chosen to remove
        // from their Jump List.  Applications must respect the user's removal of an item and not re-add any
        // item in the removed list during this list-building transaction.  Applications should also clear any
        // persited usage-tracking data for any item in the removed list.  If the user begins using a
        // previously removed item in the future, it may be re-added to the list.
        UINT cMinSlots;
        IObjectArray *poaRemoved;
        hr = pcdl->BeginList(&cMinSlots, IID_PPV_ARGS(&poaRemoved));
        if (SUCCEEDED(hr))
        {
            // Add content to the Jump List.
            hr = _AddCategoryToList(pcdl, poaRemoved);
            if (SUCCEEDED(hr))
            {
                hr = _AddTasksToList(pcdl);
                if (SUCCEEDED(hr))
                {
                    // Commit the list-building transaction.
                    hr = pcdl->CommitList();
                }
            }
            poaRemoved->Release();
        }
        pcdl->Release();
    }
}
Exemplo n.º 3
0
// @pymethod int, <o PyIObjectArray>|PyICustomDestinationList|BeginList|Clears the jump list and prepares it to be repopulated
// @rdesc Returns the number of slots and a collection of all destinations removed from the jump list
PyObject *PyICustomDestinationList::BeginList(PyObject *self, PyObject *args)
{
	ICustomDestinationList *pICDL = GetI(self);
	if ( pICDL == NULL )
		return NULL;
	UINT slots;
	REFIID riid = IID_IObjectArray;
	// @pyparm <o PyIID>|riid|IID_IObjectArray|The interface to return
	void *pv;
	if ( !PyArg_ParseTuple(args, "|O&:BeginList", PyWinObject_AsIID, &riid))
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pICDL->BeginList(&slots, riid, &pv);
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pICDL, IID_ICustomDestinationList );
	return Py_BuildValue("kN", slots, PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE));
}