From 1db36e71f24ff3887c57f5831a05b1fa8f41453f Mon Sep 17 00:00:00 2001 From: CristiFati Date: Sun, 18 Feb 2024 20:41:44 +0200 Subject: [PATCH 1/2] Add missing SVSI_* constants --- com/win32comext/shell/shellcon.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/com/win32comext/shell/shellcon.py b/com/win32comext/shell/shellcon.py index 769adf737..e97022bb6 100644 --- a/com/win32comext/shell/shellcon.py +++ b/com/win32comext/shell/shellcon.py @@ -229,6 +229,12 @@ SVSI_ENSUREVISIBLE = 8 SVSI_FOCUSED = 16 SVSI_TRANSLATEPT = 32 +SVSI_SELECTIONMARK = 64 +SVSI_POSITIONITEM = 128 +SVSI_CHECK = 256 +SVSI_CHECK2 = 512 +SVSI_KEYBOARDSELECT = 1025 +SVSI_NOTAKEFOCUS = 1073741824 SVGIO_BACKGROUND = 0 SVGIO_SELECTION = 1 SVGIO_ALLVIEW = 2 From aed3d053b5d40a5bb273de6721fd1cdc05a90269 Mon Sep 17 00:00:00 2001 From: CristiFati Date: Sun, 18 Feb 2024 20:57:36 +0200 Subject: [PATCH 2/2] IFolderView client support --- com/win32comext/shell/src/PyIFolderView.cpp | 432 ++++++++++++++++++++ com/win32comext/shell/src/PyIFolderView.h | 33 ++ com/win32comext/shell/src/shell.cpp | 33 +- setup.py | 1 + 4 files changed, 485 insertions(+), 14 deletions(-) create mode 100644 com/win32comext/shell/src/PyIFolderView.cpp create mode 100644 com/win32comext/shell/src/PyIFolderView.h diff --git a/com/win32comext/shell/src/PyIFolderView.cpp b/com/win32comext/shell/src/PyIFolderView.cpp new file mode 100644 index 000000000..e9de6b8b6 --- /dev/null +++ b/com/win32comext/shell/src/PyIFolderView.cpp @@ -0,0 +1,432 @@ +// This file implements the IFolderView Interface for Python. +// Generated by makegw.py + +#include "shell_pch.h" +#include "PyIFolderView.h" + +// Helper functions + +static PyObject *PyObject_FromPOINT(const POINT &p) { return Py_BuildValue("ll", p.x, p.y); } + +static BOOL toPIDL(PyObject *pObjId, LPITEMIDLIST *ppidl, IFolderView *self) +{ + if (PyLong_Check(pObjId)) { + int idx = (int)PyLong_AsLong(pObjId); + HRESULT hr = self->Item(idx, ppidl); + if (FAILED(hr)) { + PyCom_BuildPyException(hr, self, IID_IFolderView); + return FALSE; + } + } + else if (PyBytes_Check(pObjId)) { + // Gainarie: Create an "artificial" list ot be passed to PyObject_AsPIDL + PyObject *list = PyList_New(1); + if (list == NULL) + return FALSE; + Py_INCREF(pObjId); + PyList_SET_ITEM(list, 0, pObjId); + BOOL res = PyObject_AsPIDL(list, ppidl); + Py_DECREF(list); + if (!res) + return FALSE; + } + else { + PyErr_Format(PyExc_TypeError, "Integer (index) or bytes (PIDL) required"); + return FALSE; + } + return TRUE; +} + +// @doc - This file contains autoduck documentation +// --------------------------------------------------- +// +// Interface Implementation + +PyIFolderView::PyIFolderView(IUnknown *pdisp) : PyIUnknown(pdisp) { ob_type = &type; } + +PyIFolderView::~PyIFolderView() {} + +/* static */ IFolderView *PyIFolderView::GetI(PyObject *self) { return (IFolderView *)PyIUnknown::GetI(self); } + +// @pymethod |PyIFolderView|GetCurrentViewMode|Description of GetCurrentViewMode. +PyObject *PyIFolderView::GetCurrentViewMode(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + UINT viewMode; + if (!PyArg_ParseTuple(args, ":GetCurrentViewMode")) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetCurrentViewMode(&viewMode); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return Py_BuildValue("I", viewMode); +} + +// @pymethod |PyIFolderView|SetCurrentViewMode|Description of SetCurrentViewMode. +PyObject *PyIFolderView::SetCurrentViewMode(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm int|ViewMode||Description for ViewMode + UINT viewMode; + if (!PyArg_ParseTuple(args, "I:SetCurrentViewMode", &viewMode)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->SetCurrentViewMode(viewMode); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + Py_RETURN_NONE; +} + +// @pymethod |PyIFolderView|GetFolder|Description of GetFolder. +PyObject *PyIFolderView::GetFolder(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm |riid||Description for riid + PyObject *obriid; + IID riid; + if (!PyArg_ParseTuple(args, "O:GetFolder", &obriid)) + return NULL; + if (!PyWinObject_AsIID(obriid, &riid)) + return NULL; + HRESULT hr; + IShellFolder *ppshf = NULL; + PY_INTERFACE_PRECALL; + hr = pIFV->GetFolder(riid, (void **)&ppshf); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return PyCom_PyObjectFromIUnknown(ppshf, IID_IShellFolder, FALSE); +} + +// @pymethod |PyIFolderView|Item|Description of Item. +PyObject *PyIFolderView::Item(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm int|iItemIndex||Description for iItemIndex + int iItemIndex; + PITEMID_CHILD pidl = NULL; + if (!PyArg_ParseTuple(args, "i:Item", &iItemIndex)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->Item(iItemIndex, &pidl); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + PyObject *obppidl; + obppidl = PyObject_FromPIDL(pidl, TRUE); + if ((obppidl == Py_None) || (!PyList_Check(obppidl)) || (PyList_Size(obppidl) != 1)) { + Py_XDECREF(obppidl); + Py_RETURN_NONE; + } + PyObject *pyretval = PyList_GetItem(obppidl, 0); + Py_INCREF(pyretval); + Py_DECREF(obppidl); + return pyretval; +} + +// @pymethod |PyIFolderView|ItemCount|Description of ItemCount. +PyObject *PyIFolderView::ItemCount(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm int|uFlags||Description for uFlags + UINT uFlags; + int pcItems; + if (!PyArg_ParseTuple(args, "I:ItemCount", &uFlags)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->ItemCount(uFlags, &pcItems); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return Py_BuildValue("i", pcItems); +} + +// @pymethod |PyIFolderView|Items|Description of Items. +PyObject *PyIFolderView::Items(PyObject *self, PyObject *args) +{ + return PyErr_Format(PyExc_NotImplementedError, "Not implemented."); + /* + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm int|uFlags||Description for uFlags + // @pyparm |riid||Description for riid + // *** The input argument ppv of type "__RPC__deref_out_opt void **" was not processed *** + // Please check the conversion function is appropriate and exists! + void ppv; + PyObject *obppv; + // @pyparm |ppv||Description for ppv + PyObject *obriid; + UINT uFlags; + IID riid; + if (!PyArg_ParseTuple(args, "iOO:Items", &uFlags, &obriid, &obppv)) + return NULL; + BOOL bPythonIsHappy = TRUE; + if (!PyWinObject_AsIID(obriid, &riid)) + bPythonIsHappy = FALSE; + if (bPythonIsHappy && !PyObject_Asvoid(obppv, &ppv)) + bPythonIsHappy = FALSE; + if (!bPythonIsHappy) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->Items(uFlags, riid, ppv); + PyObject_Freevoid(ppv); + + PY_INTERFACE_POSTCALL; + + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + // *** The output argument ppv of type "__RPC__deref_out_opt void **" was not processed *** + // The type 'void' (ppv) is unknown. + Py_RETURN_NONE; + //*/ +} + +// @pymethod |PyIFolderView|GetSelectionMarkedItem|Description of GetSelectionMarkedItem. +PyObject *PyIFolderView::GetSelectionMarkedItem(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + int piItem; + if (!PyArg_ParseTuple(args, ":GetSelectionMarkedItem")) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetSelectionMarkedItem(&piItem); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return Py_BuildValue("i", piItem); +} + +// @pymethod |PyIFolderView|GetFocusedItem|Description of GetFocusedItem. +PyObject *PyIFolderView::GetFocusedItem(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + int item; + if (!PyArg_ParseTuple(args, ":GetFocusedItem")) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetFocusedItem(&item); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return Py_BuildValue("i", item); +} + +// @pymethod |PyIFolderView|GetItemPosition|Description of GetItemPosition. +PyObject *PyIFolderView::GetItemPosition(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm |pidl||Description for pidl + POINT pt; + PyObject *obpidl; + PCUITEMID_CHILD pidl = NULL; + if (!PyArg_ParseTuple(args, "O:GetItemPosition", &obpidl)) + return NULL; + if (!toPIDL(obpidl, (LPITEMIDLIST *)&pidl, pIFV)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetItemPosition(pidl, &pt); + PyObject_FreePIDL(pidl); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return PyObject_FromPOINT(pt); +} + +// @pymethod |PyIFolderView|GetSpacing|Description of GetSpacing. +PyObject *PyIFolderView::GetSpacing(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm (int, int)|pt||Coordinates of an item + POINT pt; + if (!PyArg_ParseTuple(args, "ll:GetSpacing", &pt.x, &pt.y)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetSpacing(&pt); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return PyObject_FromPOINT(pt); +} + +// @pymethod |PyIFolderView|GetDefaultSpacing|Description of GetDefaultSpacing. +PyObject *PyIFolderView::GetDefaultSpacing(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + POINT pt; + if (!PyArg_ParseTuple(args, ":GetDefaultSpacing")) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetDefaultSpacing(&pt); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + return PyObject_FromPOINT(pt); +} + +// @pymethod |PyIFolderView|GetAutoArrange|Description of GetAutoArrange. +PyObject *PyIFolderView::GetAutoArrange(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + if (!PyArg_ParseTuple(args, ":GetAutoArrange")) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->GetAutoArrange(); + PY_INTERFACE_POSTCALL; + if (hr == S_OK) + Py_RETURN_TRUE; + Py_RETURN_FALSE; +} + +// @pymethod |PyIFolderView|SelectItem|Description of SelectItem. +PyObject *PyIFolderView::SelectItem(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm int|iItem||Description for iItem + // @pyparm int|dwFlags||Description for dwFlags + int item; + DWORD dwFlags; + if (!PyArg_ParseTuple(args, "ik:SelectItem", &item, &dwFlags)) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->SelectItem(item, dwFlags); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + Py_RETURN_NONE; +} + +// @pymethod |PyIFolderView|SelectAndPositionItems|Description of SelectAndPositionItems. +PyObject *PyIFolderView::SelectAndPositionItems(PyObject *self, PyObject *args) +{ + return PyErr_Format(PyExc_NotImplementedError, "Not implemented. Use SelectAndPositionItem instead."); + /* + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + // @pyparm int|cidl||Description for cidl + // @pyparm |apidl||Description for apidl + // *** The input argument apt of type "__RPC__in_ecount_full_opt(cidl) POINT *" was not processed *** + // Please check the conversion function is appropriate and exists! + POINT apt; + PyObject *obapt; + // @pyparm |apt||Description for apt + // @pyparm int|dwFlags||Description for dwFlags + PyObject *obapidl; + UINT cidl; + PCUITEMID_CHILD_ARRAY apidl; + DWORD dwFlags; + if (!PyArg_ParseTuple(args, "iOOl:SelectAndPositionItems", &cidl, &obapidl, &obapt, &dwFlags)) + return NULL; + BOOL bPythonIsHappy = TRUE; + if (bPythonIsHappy && !PyObject_AsPIDL(obapidl, &*apidl)) + bPythonIsHappy = FALSE; + if (bPythonIsHappy && !PyObject_AsPOINT(obapt, &apt)) + bPythonIsHappy = FALSE; + if (!bPythonIsHappy) + return NULL; + HRESULT hr; + PY_INTERFACE_PRECALL; + hr = pIFV->SelectAndPositionItems(cidl, apidl, apt, dwFlags); + PyObject_FreePIDL(apidl); + PyObject_FreePOINT(apt); + + PY_INTERFACE_POSTCALL; + + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + Py_RETURN_NONE; +//*/ +} + +// @pymethod |PyIFolderView|SelectAndPositionItem|Description of SelectAndPositionItem. +PyObject *PyIFolderView::SelectAndPositionItem(PyObject *self, PyObject *args) +{ + IFolderView *pIFV = GetI(self); + if (pIFV == NULL) + return NULL; + LPITEMIDLIST pidl = NULL; + PyObject *obpidl; + POINT pt; + // @pyparm |apidl||Description for apidl + // @pyparm (int, int)|pt||Coordinates where drag operation entered the window + // @pyparm int|dwFlags||Description for dwFlags + DWORD dwFlags; + if (!PyArg_ParseTuple(args, "O(ll)k:SelectAndPositionItem", &obpidl, &pt.x, &pt.y, &dwFlags)) + return NULL; + if (!toPIDL(obpidl, &pidl, pIFV)) + return NULL; + PY_INTERFACE_PRECALL; + HRESULT hr = pIFV->SelectAndPositionItems(1, (LPCITEMIDLIST *)&pidl, &pt, dwFlags); + PyObject_FreePIDL(pidl); + PY_INTERFACE_POSTCALL; + if (FAILED(hr)) + return PyCom_BuildPyException(hr, pIFV, IID_IFolderView); + Py_RETURN_NONE; +} + +// @object PyIFolderView|Description of the interface +static struct PyMethodDef PyIFolderView_methods[] = { + {"GetCurrentViewMode", PyIFolderView::GetCurrentViewMode, + 1}, // @pymeth GetCurrentViewMode|Description of GetCurrentViewMode + {"SetCurrentViewMode", PyIFolderView::SetCurrentViewMode, + 1}, // @pymeth SetCurrentViewMode|Description of SetCurrentViewMode + {"GetFolder", PyIFolderView::GetFolder, 1}, // @pymeth GetFolder|Description of GetFolder + {"Item", PyIFolderView::Item, 1}, // @pymeth Item|Description of Item + {"ItemCount", PyIFolderView::ItemCount, 1}, // @pymeth ItemCount|Description of ItemCount + {"Items", PyIFolderView::Items, 1}, // @pymeth Items|Description of Items + {"GetSelectionMarkedItem", PyIFolderView::GetSelectionMarkedItem, + 1}, // @pymeth GetSelectionMarkedItem|Description of GetSelectionMarkedItem + {"GetFocusedItem", PyIFolderView::GetFocusedItem, 1}, // @pymeth GetFocusedItem|Description of GetFocusedItem + {"GetItemPosition", PyIFolderView::GetItemPosition, 1}, // @pymeth GetItemPosition|Description of GetItemPosition + {"GetSpacing", PyIFolderView::GetSpacing, 1}, // @pymeth GetSpacing|Description of GetSpacing + {"GetDefaultSpacing", PyIFolderView::GetDefaultSpacing, + 1}, // @pymeth GetDefaultSpacing|Description of GetDefaultSpacing + {"GetAutoArrange", PyIFolderView::GetAutoArrange, 1}, // @pymeth GetAutoArrange|Description of GetAutoArrange + {"SelectItem", PyIFolderView::SelectItem, 1}, // @pymeth SelectItem|Description of SelectItem + {"SelectAndPositionItems", PyIFolderView::SelectAndPositionItems, + 1}, // @pymeth SelectAndPositionItems|Description of SelectAndPositionItems + {"SelectAndPositionItem", PyIFolderView::SelectAndPositionItem, + 1}, // @pymeth SelectAndPositionItem|Description of SelectAndPositionItem + {NULL}}; + +PyComTypeObject PyIFolderView::type("PyIFolderView", &PyIUnknown::type, sizeof(PyIFolderView), PyIFolderView_methods, + GET_PYCOM_CTOR(PyIFolderView)); diff --git a/com/win32comext/shell/src/PyIFolderView.h b/com/win32comext/shell/src/PyIFolderView.h new file mode 100644 index 000000000..8dd85384b --- /dev/null +++ b/com/win32comext/shell/src/PyIFolderView.h @@ -0,0 +1,33 @@ +// This file declares the IFolderView Interface for Python. +// Generated by makegw.py +// --------------------------------------------------- +// +// Interface Declaration + +class PyIFolderView : public PyIUnknown { + public: + MAKE_PYCOM_CTOR(PyIFolderView); + static IFolderView *GetI(PyObject *self); + static PyComTypeObject type; + + // The Python methods + static PyObject *GetCurrentViewMode(PyObject *self, PyObject *args); + static PyObject *SetCurrentViewMode(PyObject *self, PyObject *args); + static PyObject *GetFolder(PyObject *self, PyObject *args); + static PyObject *Item(PyObject *self, PyObject *args); + static PyObject *ItemCount(PyObject *self, PyObject *args); + static PyObject *Items(PyObject *self, PyObject *args); + static PyObject *GetSelectionMarkedItem(PyObject *self, PyObject *args); + static PyObject *GetFocusedItem(PyObject *self, PyObject *args); + static PyObject *GetItemPosition(PyObject *self, PyObject *args); + static PyObject *GetSpacing(PyObject *self, PyObject *args); + static PyObject *GetDefaultSpacing(PyObject *self, PyObject *args); + static PyObject *GetAutoArrange(PyObject *self, PyObject *args); + static PyObject *SelectItem(PyObject *self, PyObject *args); + static PyObject *SelectAndPositionItems(PyObject *self, PyObject *args); + static PyObject *SelectAndPositionItem(PyObject *self, PyObject *args); + + protected: + PyIFolderView(IUnknown *pdisp); + ~PyIFolderView(); +}; diff --git a/com/win32comext/shell/src/shell.cpp b/com/win32comext/shell/src/shell.cpp index 1c5b15f43..09a48dab9 100644 --- a/com/win32comext/shell/src/shell.cpp +++ b/com/win32comext/shell/src/shell.cpp @@ -74,6 +74,7 @@ generates Windows .hlp files. #include "PyITransferAdviseSink.h" #include "PyIShellItemResources.h" #include "PyIEnumResources.h" +#include "PyIFolderView.h" #include "PyIRelatedItem.h" // Next 4 all derived from IRelatedItem #include "PyIDisplayItem.h" @@ -595,9 +596,7 @@ BOOL PyObject_AsCMINVOKECOMMANDINFO(PyObject *ob, CMINVOKECOMMANDINFO *pci) return FALSE; return TRUE; } -void PyObject_FreeCMINVOKECOMMANDINFO(CMINVOKECOMMANDINFO *pci) { - PyWinObject_FreeResourceIdA((char *)pci->lpVerb); -} +void PyObject_FreeCMINVOKECOMMANDINFO(CMINVOKECOMMANDINFO *pci) { PyWinObject_FreeResourceIdA((char *)pci->lpVerb); } static PyObject *PyString_FromMaybeNullString(const char *sz) { @@ -947,12 +946,12 @@ BOOL PyObject_AsSHFILEOPSTRUCT(PyObject *ob, SHFILEOPSTRUCT *p) memset(p, 0, sizeof(*p)); if (!PyArg_ParseTuple( ob, "OiOO|iOO", - &obhwnd, // @tupleitem 0|int|hwnd|Handle of window in which to display status messages - &p->wFunc, // @tupleitem 1|int|wFunc|One of the shellcon.FO_* values - &obFrom, // @tupleitem 2|string|From|String containing source file name(s) separated by nulls - &obTo, // @tupleitem 3|string|To|String containing destination file name(s) separated by nulls, can be - // None - &p->fFlags, // @tupleitem 4|int|flags|Combination of shellcon.FOF_* flags. Default=0 + &obhwnd, // @tupleitem 0|int|hwnd|Handle of window in which to display status messages + &p->wFunc, // @tupleitem 1|int|wFunc|One of the shellcon.FO_* values + &obFrom, // @tupleitem 2|string|From|String containing source file name(s) separated by nulls + &obTo, // @tupleitem 3|string|To|String containing destination file name(s) separated by nulls, can be + // None + &p->fFlags, // @tupleitem 4|int|flags|Combination of shellcon.FOF_* flags. Default=0 &obNameMappings, // @tupleitem 5|None|NameMappings|Maps input file names to their new names. This is // actually output, and must be None if passed as input. Default=None &obProgressTitle)) // @tupleitem 6|string|ProgressTitle|Title for progress dialog (flags must contain @@ -1275,16 +1274,20 @@ static PyObject *PySHGetSpecialFolderPath(PyObject *self, PyObject *args) return PyWinObject_FromWCHAR(buf); } -// @pymethod string|shell|SHGetKnownFolderPath|Retrieves the full path of a known folder identified by the folder's KNOWNFOLDERID. +// @pymethod string|shell|SHGetKnownFolderPath|Retrieves the full path of a known folder identified by the folder's +// KNOWNFOLDERID. static PyObject *PySHGetKnownFolderPath(PyObject *self, PyObject *args) { PyObject *obfid; PyObject *obHandle = Py_None; long flags = 0; if (!PyArg_ParseTuple(args, "O|lO:SHGetKnownFolderPath", - &obfid, // @pyparm |fid||One of the KNOWNFOLDERID constants. - &flags, // @pyparm int|flags|0|Flags that specify special retrieval options. This value can be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values. - &obHandle)) // @pyparm |token|None|An access token that represents a particular user. If this parameter is NULL, which is the most common usage, the function requests the known folder for the current user. + &obfid, // @pyparm |fid||One of the KNOWNFOLDERID constants. + &flags, // @pyparm int|flags|0|Flags that specify special retrieval options. This value can + // be 0; otherwise, one or more of the KNOWN_FOLDER_FLAG values. + &obHandle)) // @pyparm |token|None|An access token that represents a particular + // user. If this parameter is NULL, which is the most common usage, the function + // requests the known folder for the current user. return NULL; KNOWNFOLDERID fid; if (!PyWinObject_AsIID(obfid, &fid)) @@ -3651,7 +3654,8 @@ static struct PyMethodDef shell_methods[] = { 1}, // @pymeth SHGetSpecialFolderPath|Retrieves the path of a special folder. {"SHGetSpecialFolderLocation", PySHGetSpecialFolderLocation, 1}, // @pymeth SHGetSpecialFolderLocation|Retrieves the of a special folder. - {"SHGetKnownFolderPath", PySHGetKnownFolderPath, 1}, // @pymeth SHGetKnownFolderPath|Retrieves the full path of a known folder identified by the folder's KNOWNFOLDERID. + {"SHGetKnownFolderPath", PySHGetKnownFolderPath, 1}, // @pymeth SHGetKnownFolderPath|Retrieves the full path of a + // known folder identified by the folder's KNOWNFOLDERID. {"SHAddToRecentDocs", PySHAddToRecentDocs, 1}, // @pymeth SHAddToRecentDocs|Adds a document to the shell's list of recently used documents or clears all // documents from the list. The user gains access to the list through the Start menu of the Windows taskbar. @@ -3807,6 +3811,7 @@ static const PyCom_InterfaceSupportInfo g_interfaceSupportData[] = { PYCOM_INTERFACE_FULL(TransferAdviseSink), PYCOM_INTERFACE_FULL(ShellItemResources), PYCOM_INTERFACE_FULL(EnumResources), + PYCOM_INTERFACE_CLIENT_ONLY(FolderView), PYCOM_INTERFACE_FULL(RelatedItem), PYCOM_INTERFACE_FULL(TransferMediumItem), // based on IRelatedItem with no extra methods PYCOM_INTERFACE_FULL(CurrentItem), // based on IRelatedItem with no extra methods diff --git a/setup.py b/setup.py index ee28e9a91..4181b0f4d 100644 --- a/setup.py +++ b/setup.py @@ -1729,6 +1729,7 @@ def finalize_options(self): {shell}/PyIExtractImage.cpp {shell}/PyIFileOperation.cpp {shell}/PyIFileOperationProgressSink.cpp + {shell}/PyIFolderView.cpp {shell}/PyIIdentityName.cpp {shell}/PyIInputObject.cpp {shell}/PyIKnownFolder.cpp