[pywin32-checkins] /hgroot/pywin32/pywin32: Add IApplicationDocumentLists, IApplica...
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2012-09-27 06:25:19
|
changeset 32720ca1acc2 in /hgroot/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgroot/pywin32/pywin32?cmd=changeset;node=32720ca1acc2 summary: Add IApplicationDocumentLists, IApplicationDestinations, ITaskbarList, and IEnumObjects diffstat: CHANGES.txt | 8 +- com/win32comext/shell/shellcon.py | 7 + com/win32comext/shell/src/PyIApplicationDestinations.cpp | 113 +++++++ com/win32comext/shell/src/PyIApplicationDestinations.h | 26 + com/win32comext/shell/src/PyIApplicationDocumentLists.cpp | 96 ++++++ com/win32comext/shell/src/PyIApplicationDocumentLists.h | 26 + com/win32comext/shell/src/PyIEnumObjects.cpp | 163 +++++++++++ com/win32comext/shell/src/PyIEnumObjects.h | 24 + com/win32comext/shell/src/PyIShellBrowser.cpp | 4 +- com/win32comext/shell/src/PyITaskbarList.cpp | 144 ++++++++++ com/win32comext/shell/src/PyITaskbarList.h | 24 + com/win32comext/shell/src/shell.cpp | 198 +++++++------ setup.py | 4 + 13 files changed, 736 insertions(+), 101 deletions(-) diffs (truncated from 1074 to 300 lines): diff -r ec95c2687fb1 -r 32720ca1acc2 CHANGES.txt --- a/CHANGES.txt Thu Sep 27 01:05:46 2012 -0400 +++ b/CHANGES.txt Thu Sep 27 02:20:00 2012 -0400 @@ -35,7 +35,9 @@ * Python 3.3 version is built with VS2010. * win32com.shell - added function SHCreateStreamOnFileEx and - interfaces IShellItem2, IEnumShellItems + interfaces IShellItem2, IEnumShellItems, IApplicationDocumentLists, + IApplicationDestinations, ITaskbarList, IEnumObjects, + IKnownFolder, and IKnownFolderManager * win32com.propsys - Many Property System interfaces and functions added @@ -45,6 +47,10 @@ Fix iteration of objects that don't declare an enumerator in their typelib Validate syntax of constants written to makepy generated files +* win32file - Add GetFileInformationByHandleEx + +* win32api - Allow UpdateResource to remove a resource + Since build 216: ---------------- * ISAPI extension works with Python 3.x diff -r ec95c2687fb1 -r 32720ca1acc2 com/win32comext/shell/shellcon.py --- a/com/win32comext/shell/shellcon.py Thu Sep 27 01:05:46 2012 -0400 +++ b/com/win32comext/shell/shellcon.py Thu Sep 27 02:20:00 2012 -0400 @@ -1326,3 +1326,10 @@ KF_FLAG_DEFAULT_PATH = 0x00000400 KF_FLAG_NOT_PARENT_RELATIVE = 0x00000200 KF_FLAG_SIMPLE_IDLIST = 0x00000100 + + + +## APPDOCLISTTYPE, used with IApplicationDocumentLists.GetList +ADLT_RECENT = 0 +ADLT_FREQUENT = 1 + diff -r ec95c2687fb1 -r 32720ca1acc2 com/win32comext/shell/src/PyIApplicationDestinations.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/shell/src/PyIApplicationDestinations.cpp Thu Sep 27 02:20:00 2012 -0400 @@ -0,0 +1,113 @@ +// This file implements the IApplicationDestinations Interface for Python. +// Generated by makegw.py + +#include "shell_pch.h" + +// Requires Windows 7 SDK to build +#if WINVER >= 0x0601 + +#include "PyIApplicationDestinations.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIApplicationDestinations::PyIApplicationDestinations(IUnknown *pdisp): + PyIUnknown(pdisp) +{ + ob_type = &type; +} + +PyIApplicationDestinations::~PyIApplicationDestinations() +{ +} + +/* static */ IApplicationDestinations *PyIApplicationDestinations::GetI(PyObject *self) +{ + return (IApplicationDestinations *)PyIUnknown::GetI(self); +} + +// @pymethod |PyIApplicationDestinations|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 *PyIApplicationDestinations::SetAppID(PyObject *self, PyObject *args) +{ + IApplicationDestinations *pIAD = GetI(self); + if ( pIAD == 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 = pIAD->SetAppID(appid); + PY_INTERFACE_POSTCALL; + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIAD, IID_IApplicationDestinations); + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod |PyIApplicationDestinations|RemoveDestination|Removes a single entry from the jump lists +// @comm Does not remove pinned items +PyObject *PyIApplicationDestinations::RemoveDestination(PyObject *self, PyObject *args) +{ + IApplicationDestinations *pIAD = GetI(self); + if ( pIAD == NULL ) + return NULL; + IUnknown *punk; + PyObject *obpunk; + // @pyparm <o PyIUnknown>|punk||IShellItem or IShellLink representing an item in the application's jump list + if ( !PyArg_ParseTuple(args, "O:RemoveDestination", &obpunk)) + return NULL; + if (!PyCom_InterfaceFromPyObject(obpunk, IID_IUnknown, (void **)&punk, FALSE)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIAD->RemoveDestination( punk ); + punk->Release(); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIAD, IID_IApplicationDestinations ); + Py_INCREF(Py_None); + return Py_None; +} + +// @pymethod |PyIApplicationDestinations|RemoveAllDestinations|Removes all Recent and Frequent jump list entries +PyObject *PyIApplicationDestinations::RemoveAllDestinations(PyObject *self, PyObject *args) +{ + IApplicationDestinations *pIAD = GetI(self); + if ( pIAD == NULL ) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIAD->RemoveAllDestinations( ); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIAD, IID_IApplicationDestinations ); + Py_INCREF(Py_None); + return Py_None; +} + +// @object PyIApplicationDestinations|Allows an application to removed items from its jump lists +// @comm Available on Windows 7 and later +static struct PyMethodDef PyIApplicationDestinations_methods[] = +{ + { "SetAppID", PyIApplicationDestinations::SetAppID, 1 }, // @pymeth SetAppID|Specifies the application whose jump list is to be accessed + { "RemoveDestination", PyIApplicationDestinations::RemoveDestination, 1 }, // @pymeth RemoveDestination|Removes a single entry from the jump list + { "RemoveAllDestinations", PyIApplicationDestinations::RemoveAllDestinations, METH_NOARGS }, // @pymeth RemoveAllDestinations|Removes all Recent and Frequent jump list entries + { NULL } +}; + +PyComTypeObject PyIApplicationDestinations::type("PyIApplicationDestinations", + &PyIUnknown::type, + sizeof(PyIApplicationDestinations), + PyIApplicationDestinations_methods, + GET_PYCOM_CTOR(PyIApplicationDestinations)); +#endif // WINVER \ No newline at end of file diff -r ec95c2687fb1 -r 32720ca1acc2 com/win32comext/shell/src/PyIApplicationDestinations.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/shell/src/PyIApplicationDestinations.h Thu Sep 27 02:20:00 2012 -0400 @@ -0,0 +1,26 @@ +// Requires Windows 7 SDK to build +#if WINVER >= 0x0601 +// This file declares the IApplicationDestinations Interface for Python. +// Generated by makegw.py +// --------------------------------------------------- +// +// Interface Declaration + +class PyIApplicationDestinations : public PyIUnknown +{ +public: + MAKE_PYCOM_CTOR(PyIApplicationDestinations); + static IApplicationDestinations *GetI(PyObject *self); + static PyComTypeObject type; + + // The Python methods + static PyObject *SetAppID(PyObject *self, PyObject *args); + static PyObject *RemoveDestination(PyObject *self, PyObject *args); + static PyObject *RemoveAllDestinations(PyObject *self, PyObject *args); + +protected: + PyIApplicationDestinations(IUnknown *pdisp); + ~PyIApplicationDestinations(); +}; + +#endif // WINVER \ No newline at end of file diff -r ec95c2687fb1 -r 32720ca1acc2 com/win32comext/shell/src/PyIApplicationDocumentLists.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/shell/src/PyIApplicationDocumentLists.cpp Thu Sep 27 02:20:00 2012 -0400 @@ -0,0 +1,96 @@ +// This file implements the IApplicationDocumentLists Interface for Python. +// Generated by makegw.py + +#include "shell_pch.h" + +// Requires Windows 7 SDK to build +#if WINVER >= 0x0601 + +#include "PyIApplicationDocumentLists.h" + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIApplicationDocumentLists::PyIApplicationDocumentLists(IUnknown *pdisp): + PyIUnknown(pdisp) +{ + ob_type = &type; +} + +PyIApplicationDocumentLists::~PyIApplicationDocumentLists() +{ +} + +/* static */ IApplicationDocumentLists *PyIApplicationDocumentLists::GetI(PyObject *self) +{ + return (IApplicationDocumentLists *)PyIUnknown::GetI(self); +} + +// @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; +} + +// @pymethod <o PyIEnumObjects>|PyIApplicationDocumentLists|GetList|Retrieves a list of items in a jump list +PyObject *PyIApplicationDocumentLists::GetList(PyObject *self, PyObject *args) +{ + IApplicationDocumentLists *pIADL = GetI(self); + if ( pIADL == NULL ) + return NULL; + // @pyparm int|ListType||Type of document list to return, shellcon.ADLT_RECENT or ADLT_FREQUENT + // @pyparm int|ItemsDesired|0|Number of items to return, use 0 for all available + // @pyparm <o PyIID>|riid|IID_IEnumObjects|The interface to return, IID_IEnumObjects or IID_IObjectArray + APPDOCLISTTYPE listtype; + IID riid = IID_IEnumObjects; + void *ppv; + UINT cItemsDesired = 0; + if ( !PyArg_ParseTuple(args, "i|kO&:GetList", &listtype, &cItemsDesired, + PyWinObject_AsIID, &riid)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIADL->GetList( listtype, cItemsDesired, riid, &ppv ); + PY_INTERFACE_POSTCALL; + + if ( FAILED(hr) ) + return PyCom_BuildPyException(hr, pIADL, IID_IApplicationDocumentLists ); + return PyCom_PyObjectFromIUnknown((IUnknown *)ppv, riid, FALSE); +} + +// @object PyIApplicationDocumentLists|Interface used to retrieve the jump lists for an application +// @comm Available on Windows 7 and later +static struct PyMethodDef PyIApplicationDocumentLists_methods[] = +{ + { "SetAppID", PyIApplicationDocumentLists::SetAppID, 1 }, // @pymeth SetAppID|Specifies the application whose jump list is to be accessed + { "GetList", PyIApplicationDocumentLists::GetList, 1 }, // @pymeth GetList|Retrieves a list of items in a jump list + { NULL } +}; + +PyComTypeObject PyIApplicationDocumentLists::type("PyIApplicationDocumentLists", + &PyIUnknown::type, + sizeof(PyIApplicationDocumentLists), + PyIApplicationDocumentLists_methods, + GET_PYCOM_CTOR(PyIApplicationDocumentLists)); + +#endif // WINVER \ No newline at end of file diff -r ec95c2687fb1 -r 32720ca1acc2 com/win32comext/shell/src/PyIApplicationDocumentLists.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/com/win32comext/shell/src/PyIApplicationDocumentLists.h Thu Sep 27 02:20:00 2012 -0400 @@ -0,0 +1,26 @@ +// Requires Windows 7 SDK to build +#if WINVER >= 0x0601 + +// This file declares the IApplicationDocumentLists Interface for Python. +// Generated by makegw.py +// --------------------------------------------------- +// |