Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15187/com/win32comext/shell/src
Modified Files:
shell.cpp shell_pch.h
Added Files:
PyIExplorerBrowser.cpp PyIExplorerBrowser.h
PyIExplorerBrowserEvents.cpp PyIExplorerBrowserEvents.h
PyIExplorerCommand.cpp PyIExplorerCommand.h
PyIExplorerInterfaces.h PyIExtractIconW.cpp PyIExtractIconW.h
PyIShellItem.cpp PyIShellItem.h PyIShellItemArray.cpp
PyIShellItemArray.h
Log Message:
* New interfaces IExtractIconW, IExplorerBrowser, IExplorerBrowserEvents,
IExplorerCommand, IShellItem and IShellItemArray
* Fix leak of SHELLEXECUTEINFO struct each ShellExecuteEx call.
--- NEW FILE: PyIShellItemArray.cpp ---
// This file implements the IShellItemArray Interface and Gateway for Python.
// Generated by makegw.py
#include "shell_pch.h"
#include "PyIShellItemArray.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
extern BOOL PyObject_AsSHCOLUMNID(PyObject *ob, SHCOLUMNID *p);
extern PyObject *PyObject_FromSHCOLUMNID(LPCSHCOLUMNID p);
PyIShellItemArray::PyIShellItemArray(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIShellItemArray::~PyIShellItemArray()
{
}
/* static */ IShellItemArray *PyIShellItemArray::GetI(PyObject *self)
{
return (IShellItemArray *)PyIUnknown::GetI(self);
}
// @pymethod |PyIShellItemArray|BindToHandler|Description of BindToHandler.
PyObject *PyIShellItemArray::BindToHandler(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
// @pyparm <o PyIBindCtx *>|pbc||Description for pbc
// @pyparm <o PyIID>|rbhid||Description for rbhid
// @pyparm <o PyIID>|riid||Description for riid
PyObject *obpbc;
PyObject *obrbhid;
PyObject *obriid;
IBindCtx *pbc;
IID rbhid;
IID riid;
void *pvOut;
if ( !PyArg_ParseTuple(args, "OOO:BindToHandler", &obpbc, &obrbhid, &obriid) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!PyWinObject_AsIID(obrbhid, &rbhid)) bPythonIsHappy = FALSE;
if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIA->BindToHandler( pbc, rbhid, riid, &pvOut );
if (pbc) pbc->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyCom_PyObjectFromIUnknown((IUnknown *)pvOut, riid, FALSE);
}
// @pymethod |PyIShellItemArray|GetPropertyStore|Description of GetPropertyStore.
PyObject *PyIShellItemArray::GetPropertyStore(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
GETPROPERTYSTOREFLAGS flags;
// @pyparm int|flags||Description for flags
// @pyparm <o PyIID>|riid||Description for riid
PyObject *obriid;
IID riid;
void *pv;
if ( !PyArg_ParseTuple(args, "kO:GetPropertyStore", &flags, &obriid) )
return NULL;
if (!PyWinObject_AsIID(obriid, &riid))
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIA->GetPropertyStore( flags, riid, &pv );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE);
}
// @pymethod |PyIShellItemArray|GetPropertyDescriptionList|Description of GetPropertyDescriptionList.
PyObject *PyIShellItemArray::GetPropertyDescriptionList(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
PROPERTYKEY keyType;
PyObject *obkeyType;
// @pyparm <o PyREFPROPERTYKEY>|keyType||Description for keyType
// @pyparm <o PyIID>|riid||Description for riid
PyObject *obriid;
IID riid;
void *pv;
if ( !PyArg_ParseTuple(args, "OO:GetPropertyDescriptionList", &obkeyType, &obriid) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyObject_AsSHCOLUMNID(obkeyType, &keyType)) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIA->GetPropertyDescriptionList( &keyType, riid, &pv );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE);
}
// @pymethod |PyIShellItemArray|GetAttributes|Description of GetAttributes.
PyObject *PyIShellItemArray::GetAttributes(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
SIATTRIBFLAGS dwAttribFlags;
// @pyparm <o PySIATTRIBFLAGS>|dwAttribFlags||Description for dwAttribFlags
SFGAOF sfgaoMask;
// @pyparm <o PySFGAOF>|sfgaoMask||Description for sfgaoMask
if ( !PyArg_ParseTuple(args, "kk:GetAttributes", &dwAttribFlags, &sfgaoMask) )
return NULL;
SFGAOF result;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIA->GetAttributes( dwAttribFlags, sfgaoMask, &result );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyLong_FromUnsignedLong(result);
}
// @pymethod |PyIShellItemArray|GetCount|Description of GetCount.
PyObject *PyIShellItemArray::GetCount(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":GetCount") )
return NULL;
HRESULT hr;
DWORD dwNumItems;
PY_INTERFACE_PRECALL;
hr = pISIA->GetCount( &dwNumItems );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyInt_FromLong(dwNumItems);
}
// @pymethod |PyIShellItemArray|GetItemAt|Description of GetItemAt.
PyObject *PyIShellItemArray::GetItemAt(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
// @pyparm int|dwIndex||Description for dwIndex
DWORD dwIndex;
IShellItem *psi;
if ( !PyArg_ParseTuple(args, "l:GetItemAt", &dwIndex) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIA->GetItemAt( dwIndex, &psi );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyCom_PyObjectFromIUnknown(psi, IID_IShellItem, FALSE);
}
// @pymethod |PyIShellItemArray|EnumItems|Description of EnumItems.
PyObject *PyIShellItemArray::EnumItems(PyObject *self, PyObject *args)
{
IShellItemArray *pISIA = GetI(self);
if ( pISIA == NULL )
return NULL;
IEnumShellItems *penumShellItems;
if ( !PyArg_ParseTuple(args, ":EnumItems") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISIA->EnumItems( &penumShellItems );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISIA, IID_IShellItemArray );
return PyCom_PyObjectFromIUnknown(penumShellItems, IID_IEnumShellItems, FALSE);
}
// @object PyIShellItemArray|Description of the interface
static struct PyMethodDef PyIShellItemArray_methods[] =
{
{ "BindToHandler", PyIShellItemArray::BindToHandler, 1 }, // @pymeth BindToHandler|Description of BindToHandler
{ "GetPropertyStore", PyIShellItemArray::GetPropertyStore, 1 }, // @pymeth GetPropertyStore|Description of GetPropertyStore
{ "GetPropertyDescriptionList", PyIShellItemArray::GetPropertyDescriptionList, 1 }, // @pymeth GetPropertyDescriptionList|Description of GetPropertyDescriptionList
{ "GetAttributes", PyIShellItemArray::GetAttributes, 1 }, // @pymeth GetAttributes|Description of GetAttributes
{ "GetCount", PyIShellItemArray::GetCount, 1 }, // @pymeth GetCount|Description of GetCount
{ "GetItemAt", PyIShellItemArray::GetItemAt, 1 }, // @pymeth GetItemAt|Description of GetItemAt
{ "EnumItems", PyIShellItemArray::EnumItems, 1 }, // @pymeth EnumItems|Description of EnumItems
{ NULL }
};
PyComTypeObject PyIShellItemArray::type("PyIShellItemArray",
&PyIUnknown::type,
sizeof(PyIShellItemArray),
PyIShellItemArray_methods,
GET_PYCOM_CTOR(PyIShellItemArray));
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGShellItemArray::BindToHandler(
/* [unique][in] */ IBindCtx * pbc,
/* [in] */ REFGUID rbhid,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void ** ppvOut)
{
PY_GATEWAY_METHOD;
PyObject *obpbc;
PyObject *obrbhid;
PyObject *obriid;
obpbc = PyCom_PyObjectFromIUnknown(pbc, IID_IBindCtx, TRUE);
obrbhid = PyWinObject_FromIID(rbhid);
obriid = PyWinObject_FromIID(riid);
PyObject *result;
HRESULT hr=InvokeViaPolicy("BindToHandler", &result, "OOO", obpbc, obrbhid, obriid);
Py_XDECREF(obpbc);
Py_XDECREF(obrbhid);
Py_XDECREF(obriid);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppvOut;
if (!PyArg_Parse(result, "O" , &obppvOut))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppvOut, riid, (void **)ppvOut, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItemArray::GetPropertyStore(
/* [in] */ GETPROPERTYSTOREFLAGS flags,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void ** ppv)
{
PY_GATEWAY_METHOD;
PyObject *obriid;
obriid = PyWinObject_FromIID(riid);
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetPropertyStore", &result, "kO", flags, obriid);
Py_XDECREF(obriid);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppv;
if (!PyArg_Parse(result, "O" , &obppv))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetPropertyStore");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppv, riid, (void **)ppv, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetPropertyStore");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItemArray::GetPropertyDescriptionList(
/* [in] */ REFPROPERTYKEY keyType,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void ** ppv)
{
PY_GATEWAY_METHOD;
// *** The input argument keyType of type "REFPROPERTYKEY" was not processed ***
// - Please ensure this conversion function exists, and is appropriate
// - The type 'REFPROPERTYKEY' (keyType) is unknown.
PyObject *obkeyType = PyObject_FromSHCOLUMNID(keyType);
if (obkeyType==NULL) return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetPropertyDescriptionList");
PyObject *obriid;
obriid = PyWinObject_FromIID(riid);
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetPropertyDescriptionList", &result, "OO", obkeyType, obriid);
Py_DECREF(obkeyType);
Py_XDECREF(obriid);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppv;
if (!PyArg_Parse(result, "O" , &obppv))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetPropertyDescriptionList");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppv, riid, (void **)ppv, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetPropertyDescriptionList");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItemArray::GetAttributes(
/* [in] */ SIATTRIBFLAGS dwAttribFlags,
/* [in] */ SFGAOF sfgaoMask,
/* [out] */ SFGAOF * psfgaoAttribs)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetAttributes", &result, "kk", dwAttribFlags, sfgaoMask);
if (FAILED(hr)) return hr;
*psfgaoAttribs = PyLong_AsUnsignedLongMask(result);
hr = PyCom_SetAndLogCOMErrorFromPyException("GetAttributes", IID_IShellItemArray);
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItemArray::GetCount(
/* [out] */ DWORD * pdwNumItems)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetCount", &result);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
*pdwNumItems = PyLong_AsUnsignedLong(result);
hr = PyCom_SetAndLogCOMErrorFromPyException("GetCount", IID_IShellItemArray);
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItemArray::GetItemAt(
/* [in] */ DWORD dwIndex,
/* [out] */ IShellItem ** ppsi)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetItemAt", &result, "l", dwIndex);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppsi;
if (!PyArg_Parse(result, "O" , &obppsi))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetItemAt");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppsi, IID_IShellItem, (void **)ppsi, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetItemAt");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItemArray::EnumItems(
/* [out] */ IEnumShellItems ** ppenumShellItems)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("EnumItems", &result);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppenumShellItems;
if (!PyArg_Parse(result, "O" , &obppenumShellItems))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("EnumItems");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppenumShellItems, IID_IEnumShellItems, (void **)ppenumShellItems, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("EnumItems");
Py_DECREF(result);
return hr;
}
--- NEW FILE: PyIExplorerBrowserEvents.h ---
// This file declares the IExplorerBrowserEvents Interface and Gateway for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Interface Declaration
class PyIExplorerBrowserEvents : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIExplorerBrowserEvents);
static IExplorerBrowserEvents *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *OnNavigationPending(PyObject *self, PyObject *args);
static PyObject *OnViewCreated(PyObject *self, PyObject *args);
static PyObject *OnNavigationComplete(PyObject *self, PyObject *args);
static PyObject *OnNavigationFailed(PyObject *self, PyObject *args);
protected:
PyIExplorerBrowserEvents(IUnknown *pdisp);
~PyIExplorerBrowserEvents();
};
// ---------------------------------------------------
//
// Gateway Declaration
class PyGExplorerBrowserEvents : public PyGatewayBase, public IExplorerBrowserEvents
{
protected:
PyGExplorerBrowserEvents(PyObject *instance) : PyGatewayBase(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGExplorerBrowserEvents, IExplorerBrowserEvents, IID_IExplorerBrowserEvents, PyGatewayBase)
// IExplorerBrowserEvents
STDMETHOD(OnNavigationPending)(
PCIDLIST_ABSOLUTE pidlFolder);
STDMETHOD(OnViewCreated)(
IShellView * psv);
STDMETHOD(OnNavigationComplete)(
PCIDLIST_ABSOLUTE pidlFolder);
STDMETHOD(OnNavigationFailed)(
PCIDLIST_ABSOLUTE pidlFolder);
};
Index: shell_pch.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell_pch.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** shell_pch.h 6 Apr 2006 10:37:07 -0000 1.7
--- shell_pch.h 8 Jan 2008 00:41:03 -0000 1.8
***************
*** 35,36 ****
--- 35,71 ----
BOOL PyObject_AsRECT( PyObject *ob, RECT *r);
PyObject *PyObject_FromRECT(const RECT *r);
+
+ // For the Vista IExplorer* interfaces
+ #include "PyIExplorerInterfaces.h"
+
+ BOOL PyObject_AsEXPLORER_BROWSER_OPTIONS(PyObject *, EXPLORER_BROWSER_OPTIONS *);
+ PyObject *PyObject_FromEXPLORER_BROWSER_OPTIONS(EXPLORER_BROWSER_OPTIONS);
+
+ BOOL PyObject_AsEXPLORER_BROWSER_FILL_FLAGS(PyObject *, EXPLORER_BROWSER_FILL_FLAGS *);
+ PyObject *PyObject_FromEXPLORER_BROWSER_FILL_FLAGS(EXPLORER_BROWSER_FILL_FLAGS);
+
+ extern void *PyShell_AllocMem(ULONG cb);
+
+ // Vista has new spellings for PIDL.
+ inline BOOL PyObject_AsPCUIDLIST_RELATIVE(PyObject *ob, PCUIDLIST_RELATIVE *ppidl, BOOL bNoneOK = FALSE, UINT *pcb = NULL)
+ {
+ return PyObject_AsPIDL(ob, (LPITEMIDLIST *)ppidl, bNoneOK, pcb);
+ }
+ inline void PyObject_FreePCUIDLIST_RELATIVE(PCUIDLIST_RELATIVE pidl)
+ {
+ return PyObject_FreePIDL((LPCITEMIDLIST)pidl);
+ }
+
+ inline BOOL PyObject_AsPCIDLIST_ABSOLUTE(PyObject *ob, PCUIDLIST_ABSOLUTE *ppidl, BOOL bNoneOK = FALSE, UINT *pcb = NULL)
+ {
+ return PyObject_AsPIDL(ob, (LPITEMIDLIST *)ppidl, bNoneOK, pcb);
+ }
+ inline void PyObject_FreePCIDLIST_ABSOLUTE(PCIDLIST_ABSOLUTE pidl)
+ {
+ return PyObject_FreePIDL((LPCITEMIDLIST)pidl);
+ }
+
+ inline PyObject *PyObject_FromPCIDLIST_ABSOLUTE(PCUIDLIST_ABSOLUTE pidl, BOOL bFreeSystemPIDL)
+ {
+ return PyObject_FromPIDL((LPITEMIDLIST)pidl, bFreeSystemPIDL);
+ }
Index: shell.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** shell.cpp 18 Jul 2007 08:46:24 -0000 1.59
--- shell.cpp 8 Jan 2008 00:41:03 -0000 1.60
***************
*** 21,24 ****
--- 21,25 ----
#include "PyIContextMenu.h"
#include "PyIExtractIcon.h"
+ #include "PyIExtractIconW.h"
#include "PyIShellExtInit.h"
#include "PyIShellFolder.h"
***************
*** 47,50 ****
--- 48,56 ----
#include "PyIActiveDesktop.h"
#include "PyIExtractImage.h"
+ #include "PyIExplorerBrowser.h"
+ #include "PyIExplorerBrowserEvents.h"
+ #include "PyIExplorerCommand.h"
+ #include "PyIShellItem.h"
+ #include "PyIShellItemArray.h"
#include "PythonCOMRegister.h" // For simpler registration of IIDs etc.
***************
*** 53,56 ****
--- 59,71 ----
#define OleSetOleError PyCom_BuildPyException
+ #if (WINVER < 0x600)
+ const IID IID_IExplorerBrowser = __uuidof(IExplorerBrowser);
+ const IID IID_IExplorerBrowserEvents = __uuidof(IExplorerBrowserEvents);
+ const IID IID_IExplorerCommand = __uuidof(IExplorerCommand);
+ const IID IID_IShellItemArray = __uuidof(IShellItemArray);
+ const IID IID_IEnumExplorerCommand = __uuidof(IEnumExplorerCommand);
+ const IID IID_IEnumShellItems = __uuidof(IEnumShellItems);
+ #endif
+
static HMODULE shell32 = NULL;
static HMODULE shfolder = NULL;
***************
*** 862,865 ****
--- 877,901 ----
}
+ BOOL PyObject_AsEXPLORER_BROWSER_OPTIONS(PyObject *ob, EXPLORER_BROWSER_OPTIONS *ret)
+ {
+ *ret = PyLong_AsUnsignedLongMask(ob);
+ return *ret != -1 || !PyErr_Occurred();
+ }
+
+ PyObject *PyObject_FromEXPLORER_BROWSER_OPTIONS(EXPLORER_BROWSER_OPTIONS val)
+ {
+ return PyLong_FromUnsignedLong(val);
+ }
+
+ BOOL PyObject_AsEXPLORER_BROWSER_FILL_FLAGS(PyObject *ob, EXPLORER_BROWSER_FILL_FLAGS *ret)
+ {
+ *ret = PyLong_AsUnsignedLongMask(ob);
+ return *ret != -1 || !PyErr_Occurred();
+ }
+ PyObject *PyObject_FromEXPLORER_BROWSER_FILL_FLAGS(EXPLORER_BROWSER_FILL_FLAGS val)
+ {
+ return PyLong_FromUnsignedLong(val);
+ }
+
#if (PY_VERSION_HEX >= 0x02030000) // PyGILState only in 2.3+
***************
*** 1433,1442 ****
break;
case SHCNF_DWORD:
! p1 = (void *)PyInt_AsLong(ob1);
! if (p1==(VOID *)-1 && PyErr_Occurred())
bsuccess=FALSE;
else if (ob2!=Py_None){
! p2 = (void *)PyInt_AsLong(ob2);
! if (p2==(void *)-1 && PyErr_Occurred())
bsuccess=FALSE;
}
--- 1469,1476 ----
break;
case SHCNF_DWORD:
! if (!PyWinLong_AsVoidPtr(ob1, &p1))
bsuccess=FALSE;
else if (ob2!=Py_None){
! if (!PyWinLong_AsVoidPtr(ob2, &p2))
bsuccess=FALSE;
}
***************
*** 2077,2086 ****
PyObject *ret = NULL;
BOOL ok;
! SHELLEXECUTEINFO *p = (SHELLEXECUTEINFO *)malloc(sizeof(*p));
! if (!p)
! return PyErr_NoMemory();
!
! memset(p, 0, sizeof(*p));
! p->cbSize = sizeof(*p);
static char *kw_items[]= {
--- 2111,2117 ----
PyObject *ret = NULL;
BOOL ok;
! SHELLEXECUTEINFO info;
! memset(&info, 0, sizeof(info));
! info.cbSize = sizeof(info);
static char *kw_items[]= {
***************
*** 2093,2101 ****
PyObject *obhkeyClass = NULL, *obHotKey = NULL, *obhIcon = NULL;
PyObject *obhMonitor = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kw, "|lOOOOOlOOOOOO", kw_items,
! // @pyparm int|fMask|0|The default mask for the
! // structure. Other masks may be added based on
! // what paramaters are supplied.
! &p->fMask,
&obhwnd, // @pyparm <o PyHANDLE>|hwnd|0|
&obVerb, // @pyparm string|lpVerb||
--- 2124,2131 ----
PyObject *obhkeyClass = NULL, *obHotKey = NULL, *obhIcon = NULL;
PyObject *obhMonitor = NULL;
+ // @pyparm int|fMask|0|The default mask for the structure. Other
+ // masks may be added based on what paramaters are supplied.
if (!PyArg_ParseTupleAndKeywords(args, kw, "|lOOOOOlOOOOOO", kw_items,
! &info.fMask,
&obhwnd, // @pyparm <o PyHANDLE>|hwnd|0|
&obVerb, // @pyparm string|lpVerb||
***************
*** 2103,2107 ****
&obParams, // @pyparm string|lpParams||
&obDirectory, // @pyparm string|lpDirectory||
! &p->nShow, // @pyparm int|nShow|0|
&obIDList, // @pyparm <o PyIDL>|lpIDList||
&obClass, // @pyparm string|obClass||
--- 2133,2137 ----
&obParams, // @pyparm string|lpParams||
&obDirectory, // @pyparm string|lpDirectory||
! &info.nShow, // @pyparm int|nShow|0|
&obIDList, // @pyparm <o PyIDL>|lpIDList||
&obClass, // @pyparm string|obClass||
***************
*** 2111,2142 ****
&obhMonitor)) // @pyparm <o PyHANDLE>|hMonitor||
goto done;
! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&p->hwnd))
goto done;
! if (obVerb && !PyWinObject_AsString(obVerb, (char **)&p->lpVerb))
goto done;
! if (obFile && !PyWinObject_AsString(obFile, (char **)&p->lpFile))
goto done;
! if (obParams && !PyWinObject_AsString(obParams, (char **)&p->lpParameters))
goto done;
! if (obDirectory && !PyWinObject_AsString(obDirectory, (char **)&p->lpDirectory))
goto done;
if (obIDList) {
! p->fMask |= SEE_MASK_IDLIST;
! if (!PyObject_AsPIDL(obIDList, (ITEMIDLIST **)&p->lpIDList))
goto done;
}
if (obClass) {
! p->fMask |= SEE_MASK_CLASSNAME;
! if (!PyWinObject_AsString(obClass, (char **)&p->lpClass))
goto done;
}
if (obhkeyClass) {
! p->fMask |= SEE_MASK_CLASSKEY;
! if (!PyWinObject_AsHKEY(obhkeyClass, &p->hkeyClass))
goto done;
}
if (obHotKey) {
! p->fMask |= SEE_MASK_HOTKEY;
! p->dwHotKey = PyInt_AsLong(obHotKey);
if (PyErr_Occurred())
goto done;
--- 2141,2172 ----
&obhMonitor)) // @pyparm <o PyHANDLE>|hMonitor||
goto done;
! if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&info.hwnd))
goto done;
! if (obVerb && !PyWinObject_AsString(obVerb, (char **)&info.lpVerb))
goto done;
! if (obFile && !PyWinObject_AsString(obFile, (char **)&info.lpFile))
goto done;
! if (obParams && !PyWinObject_AsString(obParams, (char **)&info.lpParameters))
goto done;
! if (obDirectory && !PyWinObject_AsString(obDirectory, (char **)&info.lpDirectory))
goto done;
if (obIDList) {
! info.fMask |= SEE_MASK_IDLIST;
! if (!PyObject_AsPIDL(obIDList, (ITEMIDLIST **)&info.lpIDList))
goto done;
}
if (obClass) {
! info.fMask |= SEE_MASK_CLASSNAME;
! if (!PyWinObject_AsString(obClass, (char **)&info.lpClass))
goto done;
}
if (obhkeyClass) {
! info.fMask |= SEE_MASK_CLASSKEY;
! if (!PyWinObject_AsHKEY(obhkeyClass, &info.hkeyClass))
goto done;
}
if (obHotKey) {
! info.fMask |= SEE_MASK_HOTKEY;
! info.dwHotKey = PyInt_AsLong(obHotKey);
if (PyErr_Occurred())
goto done;
***************
*** 2148,2170 ****
goto done;
#else
! p->fMask |= SEE_MASK_ICON;
! if (!PyWinObject_AsHANDLE(obhIcon, &p->hIcon))
goto done;
#endif
}
if (obhMonitor) {
! p->fMask |= SEE_MASK_HMONITOR;
! if (!PyWinObject_AsHANDLE(obhMonitor, &p->hMonitor))
goto done;
}
{ // new scope to avoid warnings about the goto
PY_INTERFACE_PRECALL;
! ok = ShellExecuteEx(p);
PY_INTERFACE_POSTCALL;
}
if (ok) {
ret = Py_BuildValue("{s:l,s:N}",
! "hInstApp", p->hInstApp,
! "hProcess", PyWinObject_FromHANDLE(p->hProcess));
// @rdesc The result is a dictionary based on documented result values
// in the structure. Currently this is "hInstApp" and "hProcess"
--- 2178,2200 ----
goto done;
#else
! info.fMask |= SEE_MASK_ICON;
! if (!PyWinObject_AsHANDLE(obhIcon, &info.hIcon))
goto done;
#endif
}
if (obhMonitor) {
! info.fMask |= SEE_MASK_HMONITOR;
! if (!PyWinObject_AsHANDLE(obhMonitor, &info.hMonitor))
goto done;
}
{ // new scope to avoid warnings about the goto
PY_INTERFACE_PRECALL;
! ok = ShellExecuteEx(&info);
PY_INTERFACE_POSTCALL;
}
if (ok) {
ret = Py_BuildValue("{s:l,s:N}",
! "hInstApp", info.hInstApp,
! "hProcess", PyWinObject_FromHANDLE(info.hProcess));
// @rdesc The result is a dictionary based on documented result values
// in the structure. Currently this is "hInstApp" and "hProcess"
***************
*** 2173,2182 ****
done:
! PyWinObject_FreeString((char *)p->lpVerb);
! PyWinObject_FreeString((char *)p->lpFile);
! PyWinObject_FreeString((char *)p->lpParameters);
! PyWinObject_FreeString((char *)p->lpDirectory);
! PyWinObject_FreeString((char *)p->lpClass);
! PyObject_FreePIDL((ITEMIDLIST *)p->lpIDList);
return ret;
}
--- 2203,2212 ----
done:
! PyWinObject_FreeString((char *)info.lpVerb);
! PyWinObject_FreeString((char *)info.lpFile);
! PyWinObject_FreeString((char *)info.lpParameters);
! PyWinObject_FreeString((char *)info.lpDirectory);
! PyWinObject_FreeString((char *)info.lpClass);
! PyObject_FreePIDL((ITEMIDLIST *)info.lpIDList);
return ret;
}
***************
*** 2338,2343 ****
PYCOM_INTERFACE_FULL(ContextMenu),
PYCOM_INTERFACE_FULL(ExtractIcon),
PYCOM_INTERFACE_CLIENT_ONLY (ExtractImage),
- PYCOM_INTERFACE_IID_ONLY (ExtractIconW),
PYCOM_INTERFACE_FULL(ShellExtInit),
PYCOM_INTERFACE_FULL(ShellFolder),
--- 2368,2373 ----
PYCOM_INTERFACE_FULL(ContextMenu),
PYCOM_INTERFACE_FULL(ExtractIcon),
+ PYCOM_INTERFACE_FULL(ExtractIconW),
PYCOM_INTERFACE_CLIENT_ONLY (ExtractImage),
PYCOM_INTERFACE_FULL(ShellExtInit),
PYCOM_INTERFACE_FULL(ShellFolder),
***************
*** 2359,2365 ****
--- 2389,2400 ----
PYCOM_INTERFACE_SERVER_ONLY(EmptyVolumeCache),
PYCOM_INTERFACE_SERVER_ONLY(EmptyVolumeCache2),
+ PYCOM_INTERFACE_CLIENT_ONLY(ExplorerBrowser),
+ PYCOM_INTERFACE_FULL(ExplorerBrowserEvents),
+ PYCOM_INTERFACE_FULL(ExplorerCommand),
// IID_ICopyHook doesn't exist - hack it up
{ &IID_IShellCopyHook, "IShellCopyHook", "IID_IShellCopyHook", &PyICopyHook::type, GET_PYGATEWAY_CTOR(PyGCopyHook) },
{ &IID_IShellCopyHook, "ICopyHook", "IID_ICopyHook", NULL, NULL },
+ PYCOM_INTERFACE_FULL(ShellItem),
+ PYCOM_INTERFACE_FULL(ShellItemArray),
PYCOM_INTERFACE_CLIENT_ONLY(ShellLinkDataList),
PYCOM_INTERFACE_CLIENT_ONLY(UniformResourceLocator),
***************
*** 2457,2460 ****
--- 2492,2496 ----
ADD_CONSTANT(HOTKEYF_EXT);
ADD_CONSTANT(HOTKEYF_SHIFT);
+
ADD_IID(CLSID_ShellLink);
ADD_IID(CLSID_ShellDesktop);
***************
*** 2509,2513 ****
ADD_IID(FMTID_MediaFileSummaryInformation);
ADD_IID(FMTID_ImageSummaryInformation);
!
#else
# pragma message("Please update your SDK headers - IE5 features missing!")
--- 2545,2549 ----
ADD_IID(FMTID_MediaFileSummaryInformation);
ADD_IID(FMTID_ImageSummaryInformation);
! ADD_IID(IID_CDefView);
#else
# pragma message("Please update your SDK headers - IE5 features missing!")
--- NEW FILE: PyIShellItem.cpp ---
// This file implements the IShellItem Interface and Gateway for Python.
// Generated by makegw.py
#include "shell_pch.h"
#include "PyIShellItem.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIShellItem::PyIShellItem(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIShellItem::~PyIShellItem()
{
}
/* static */ IShellItem *PyIShellItem::GetI(PyObject *self)
{
return (IShellItem *)PyIUnknown::GetI(self);
}
// @pymethod |PyIShellItem|BindToHandler|Description of BindToHandler.
PyObject *PyIShellItem::BindToHandler(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
// @pyparm <o PyIBindCtx *>|pbc||Description for pbc
// @pyparm <o PyIID>|bhid||Description for bhid
// @pyparm <o PyIID>|riid||Description for riid
PyObject *obpbc;
PyObject *obbhid;
PyObject *obriid;
IBindCtx *pbc;
IID bhid;
IID riid;
void *pv;
if ( !PyArg_ParseTuple(args, "OOO:BindToHandler", &obpbc, &obbhid, &obriid) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!PyWinObject_AsIID(obbhid, &bhid)) bPythonIsHappy = FALSE;
if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISI->BindToHandler( pbc, bhid, riid, &pv );
if (pbc) pbc->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyCom_PyObjectFromIUnknown((IUnknown *)pv, riid, FALSE);
}
// @pymethod |PyIShellItem|GetParent|Description of GetParent.
PyObject *PyIShellItem::GetParent(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
IShellItem *psi;
if ( !PyArg_ParseTuple(args, ":GetParent") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISI->GetParent( &psi );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyCom_PyObjectFromIUnknown(psi, IID_IShellItem, FALSE);
}
// @pymethod |PyIShellItem|GetDisplayName|Description of GetDisplayName.
PyObject *PyIShellItem::GetDisplayName(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
SIGDN sigdnName;
// @pyparm int|sigdnName||Description for sigdnName
if ( !PyArg_ParseTuple(args, "k:GetDisplayName", &sigdnName) )
return NULL;
HRESULT hr;
WCHAR *sz;
PY_INTERFACE_PRECALL;
hr = pISI->GetDisplayName( sigdnName, &sz );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
PyObject *ret = PyWinObject_FromWCHAR(sz);
CoTaskMemFree(sz);
return ret;
}
// @pymethod |PyIShellItem|GetAttributes|Description of GetAttributes.
PyObject *PyIShellItem::GetAttributes(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
SFGAOF sfgaoMask;
SFGAOF ret;
// @pyparm <o PySFGAOF>|sfgaoMask||Description for sfgaoMask
if ( !PyArg_ParseTuple(args, "k:GetAttributes", &sfgaoMask) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISI->GetAttributes( sfgaoMask, &ret);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyLong_FromUnsignedLong(ret);
}
// @pymethod |PyIShellItem|Compare|Description of Compare.
PyObject *PyIShellItem::Compare(PyObject *self, PyObject *args)
{
IShellItem *pISI = GetI(self);
if ( pISI == NULL )
return NULL;
// @pyparm <o PyIShellItem *>|psi||Description for psi
SICHINTF hint;
// @pyparm int|hint||Description for hint
PyObject *obpsi;
IShellItem *psi;
if ( !PyArg_ParseTuple(args, "Oi:Compare", &obpsi, &hint) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsi, IID_IShellItem, (void **)&psi, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
int iOrder;
PY_INTERFACE_PRECALL;
hr = pISI->Compare( psi, hint, &iOrder );
if (psi) psi->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pISI, IID_IShellItem );
return PyInt_FromLong(iOrder);
}
// @object PyIShellItem|Description of the interface
static struct PyMethodDef PyIShellItem_methods[] =
{
{ "BindToHandler", PyIShellItem::BindToHandler, 1 }, // @pymeth BindToHandler|Description of BindToHandler
{ "GetParent", PyIShellItem::GetParent, 1 }, // @pymeth GetParent|Description of GetParent
{ "GetDisplayName", PyIShellItem::GetDisplayName, 1 }, // @pymeth GetDisplayName|Description of GetDisplayName
{ "GetAttributes", PyIShellItem::GetAttributes, 1 }, // @pymeth GetAttributes|Description of GetAttributes
{ "Compare", PyIShellItem::Compare, 1 }, // @pymeth Compare|Description of Compare
{ NULL }
};
PyComTypeObject PyIShellItem::type("PyIShellItem",
&PyIUnknown::type,
sizeof(PyIShellItem),
PyIShellItem_methods,
GET_PYCOM_CTOR(PyIShellItem));
// ---------------------------------------------------
//
// Gateway Implementation
STDMETHODIMP PyGShellItem::BindToHandler(
/* [unique][in] */ IBindCtx * pbc,
/* [in] */ REFGUID bhid,
/* [in] */ REFIID riid,
/* [iid_is][out] */ void ** ppv)
{
PY_GATEWAY_METHOD;
PyObject *obpbc;
PyObject *obbhid;
PyObject *obriid;
obpbc = PyCom_PyObjectFromIUnknown(pbc, IID_IBindCtx, TRUE);
obbhid = PyWinObject_FromIID(bhid);
obriid = PyWinObject_FromIID(riid);
PyObject *result;
HRESULT hr=InvokeViaPolicy("BindToHandler", &result, "OOO", obpbc, obbhid, obriid);
Py_XDECREF(obpbc);
Py_XDECREF(obbhid);
Py_XDECREF(obriid);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppv;
if (!PyArg_Parse(result, "O" , &obppv))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppv, riid, (void **)ppv, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("BindToHandler");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItem::GetParent(
/* [out] */ IShellItem ** ppsi)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetParent", &result);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
PyObject *obppsi;
if (!PyArg_Parse(result, "O" , &obppsi))
return MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetParent");
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obppsi, IID_IShellItem, (void **)ppsi, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) hr = MAKE_PYCOM_GATEWAY_FAILURE_CODE("GetParent");
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItem::GetDisplayName(
/* [in] */ SIGDN sigdnName,
/* [string][out] */ LPWSTR * ppszName)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetDisplayName", &result, "k", sigdnName);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
if (!PyWinObject_AsPfnAllocatedWCHAR(result, PyShell_AllocMem, ppszName))
hr = PyCom_SetAndLogCOMErrorFromPyException("GetDisplayName", IID_IShellItem);
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItem::GetAttributes(
/* [in] */ SFGAOF sfgaoMask,
/* [out] */ SFGAOF * psfgaoAttribs)
{
PY_GATEWAY_METHOD;
PyObject *result;
HRESULT hr=InvokeViaPolicy("GetAttributes", &result, "k", sfgaoMask);
if (FAILED(hr)) return hr;
// Process the Python results, and convert back to the real params
*psfgaoAttribs = PyLong_AsUnsignedLongMask(result);
hr = PyCom_SetAndLogCOMErrorFromPyException("GetAttributes", IID_IShellItem);
Py_DECREF(result);
return hr;
}
STDMETHODIMP PyGShellItem::Compare(
/* [in] */ IShellItem * psi,
/* [in] */ SICHINTF hint,
/* [out] */ int * piOrder)
{
PY_GATEWAY_METHOD;
PyObject *obpsi;
obpsi = PyCom_PyObjectFromIUnknown(psi, IID_IShellItem, TRUE);
PyObject *result;
HRESULT hr=InvokeViaPolicy("Compare", &result, "Ok", obpsi, hint);
Py_XDECREF(obpsi);
if (FAILED(hr)) return hr;
*piOrder = PyInt_AsLong(result);
hr = PyCom_SetAndLogCOMErrorFromPyException("Compare", IID_IShellItem);
Py_DECREF(result);
return hr;
}
--- NEW FILE: PyIExplorerBrowser.cpp ---
// This file implements the IExplorerBrowser Interface and Gateway for Python.
// Generated by makegw.py
#include "shell_pch.h"
#include "PyIExplorerBrowser.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIExplorerBrowser::PyIExplorerBrowser(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIExplorerBrowser::~PyIExplorerBrowser()
{
}
/* static */ IExplorerBrowser *PyIExplorerBrowser::GetI(PyObject *self)
{
return (IExplorerBrowser *)PyIUnknown::GetI(self);
}
// @pymethod |PyIExplorerBrowser|Initialize|Description of Initialize.
PyObject *PyIExplorerBrowser::Initialize(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm HWND|hwndParent||Description for hwndParent
RECT rc;
PyObject *obprc;
// @pyparm <o PyRECT>|prc||Description for prc
FOLDERSETTINGS fs;
PyObject *obpfs;
// @pyparm <o PyFOLDERSETTINGS *>|pfs||Description for pfs
HWND hwndParent;
PyObject *obhwnd;
if ( !PyArg_ParseTuple(args, "OOO:Initialize", &obhwnd, &obprc, &obpfs) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&hwndParent)) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyWinObject_AsRECT(obprc, &rc)) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyObject_AsFOLDERSETTINGS(obpfs, &fs)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->Initialize( hwndParent, &rc, &fs );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|Destroy|Description of Destroy.
PyObject *PyIExplorerBrowser::Destroy(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":Destroy") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->Destroy( );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod <o PyHANDLE>|PyIExplorerBrowser|SetRect|Description of SetRect.
PyObject *PyIExplorerBrowser::SetRect(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
HDWP hdwp;
PyObject *obphdwp;
// @pyparm <o PyHDWP *>|phdwp||Description for phdwp
RECT rcBrowser;
PyObject *obrcBrowser;
// @pyparm <o PyRECT>|rcBrowser||Description for rcBrowser
if ( !PyArg_ParseTuple(args, "OO:SetRect", &obphdwp, &obrcBrowser) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyWinObject_AsHANDLE( obphdwp, &hdwp )) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyWinObject_AsRECT( obrcBrowser, &rcBrowser )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->SetRect( &hdwp, rcBrowser );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
return PyWinLong_FromHANDLE(hdwp);
}
// @pymethod |PyIExplorerBrowser|SetPropertyBag|Description of SetPropertyBag.
PyObject *PyIExplorerBrowser::SetPropertyBag(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm <o unicode>|pszPropertyBag||Description for pszPropertyBag
PyObject *obpszPropertyBag;
LPWSTR pszPropertyBag;
if ( !PyArg_ParseTuple(args, "O:SetPropertyBag", &obpszPropertyBag) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyWinObject_AsBstr(obpszPropertyBag, &pszPropertyBag)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->SetPropertyBag( pszPropertyBag );
SysFreeString(pszPropertyBag);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|SetEmptyText|Description of SetEmptyText.
PyObject *PyIExplorerBrowser::SetEmptyText(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm <o unicode>|pszEmptyText||Description for pszEmptyText
PyObject *obpszEmptyText;
LPWSTR pszEmptyText;
if ( !PyArg_ParseTuple(args, "O:SetEmptyText", &obpszEmptyText) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyWinObject_AsBstr(obpszEmptyText, &pszEmptyText)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->SetEmptyText( pszEmptyText );
SysFreeString(pszEmptyText);
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|SetFolderSettings|Description of SetFolderSettings.
PyObject *PyIExplorerBrowser::SetFolderSettings(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
FOLDERSETTINGS fs;
PyObject *obpfs;
// @pyparm <o PyFOLDERSETTINGS *>|pfs||Description for pfs
if ( !PyArg_ParseTuple(args, "O:SetFolderSettings", &obpfs) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyObject_AsFOLDERSETTINGS( obpfs, &fs )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->SetFolderSettings( &fs );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod int|PyIExplorerBrowser|Advise|Description of Advise.
PyObject *PyIExplorerBrowser::Advise(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm <o PyIExplorerBrowserEvents *>|psbe||Description for psbe
// @pyparm <o PyDWORD *>|pdwCookie||Description for pdwCookie
PyObject *obpsbe;
IExplorerBrowserEvents *psbe;
if ( !PyArg_ParseTuple(args, "O:Advise", &obpsbe) )
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obpsbe, IID_IExplorerBrowserEvents, (void **)&psbe, TRUE /* bNoneOK */))
return NULL;
HRESULT hr;
DWORD dwCookie;
PY_INTERFACE_PRECALL;
hr = pIEB->Advise( psbe, &dwCookie );
if (psbe) psbe->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
return PyInt_FromLong(dwCookie);
}
// @pymethod |PyIExplorerBrowser|Unadvise|Description of Unadvise.
PyObject *PyIExplorerBrowser::Unadvise(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm int|dwCookie||Description for dwCookie
DWORD dwCookie;
if ( !PyArg_ParseTuple(args, "l:Unadvise", &dwCookie) )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->Unadvise( dwCookie );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|SetOptions|Description of SetOptions.
PyObject *PyIExplorerBrowser::SetOptions(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
EXPLORER_BROWSER_OPTIONS dwFlag;
PyObject *obdwFlag;
// @pyparm <o PyEXPLORER_BROWSER_OPTIONS>|dwFlag||Description for dwFlag
if ( !PyArg_ParseTuple(args, "O:SetOptions", &obdwFlag) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyObject_AsEXPLORER_BROWSER_OPTIONS( obdwFlag, &dwFlag )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->SetOptions( dwFlag );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod int|PyIExplorerBrowser|GetOptions|Description of GetOptions.
PyObject *PyIExplorerBrowser::GetOptions(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
EXPLORER_BROWSER_OPTIONS dwFlag;
PyObject *obpdwFlag;
// @pyparm <o PyEXPLORER_BROWSER_OPTIONS *>|pdwFlag||Description for pdwFlag
if ( !PyArg_ParseTuple(args, "O:GetOptions", &obpdwFlag) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyObject_AsEXPLORER_BROWSER_OPTIONS( obpdwFlag, &dwFlag )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->GetOptions( &dwFlag );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
return PyInt_FromLong(dwFlag);
}
// @pymethod |PyIExplorerBrowser|BrowseToIDList|Description of BrowseToIDList.
PyObject *PyIExplorerBrowser::BrowseToIDList(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
PCUIDLIST_RELATIVE pidl;
PyObject *obpidl;
// @pyparm <o PyPCUIDLIST_RELATIVE>|pidl||Description for pidl
// @pyparm int|uFlags||Description for uFlags
UINT uFlags;
if ( !PyArg_ParseTuple(args, "Oi:BrowseToIDList", &obpidl, &uFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyObject_AsPCUIDLIST_RELATIVE( obpidl, &pidl, TRUE )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->BrowseToIDList( pidl, uFlags );
PY_INTERFACE_POSTCALL;
PyObject_FreePCUIDLIST_RELATIVE(pidl);
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|BrowseToObject|Description of BrowseToObject.
PyObject *PyIExplorerBrowser::BrowseToObject(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm <o PyIUnknown *>|punk||Description for punk
// @pyparm int|uFlags||Description for uFlags
PyObject *obpunk;
IUnknown *punk;
UINT uFlags;
if ( !PyArg_ParseTuple(args, "Oi:BrowseToObject", &obpunk, &uFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpunk, IID_IUnknown, (void **)&punk, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->BrowseToObject( punk, uFlags );
if (punk) punk->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|FillFromObject|Description of FillFromObject.
PyObject *PyIExplorerBrowser::FillFromObject(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm <o PyIUnknown *>|punk||Description for punk
EXPLORER_BROWSER_FILL_FLAGS dwFlags;
PyObject *obdwFlags;
// @pyparm <o PyEXPLORER_BROWSER_FILL_FLAGS>|dwFlags||Description for dwFlags
PyObject *obpunk;
IUnknown * punk;
if ( !PyArg_ParseTuple(args, "OO:FillFromObject", &obpunk, &obdwFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpunk, IID_IUnknown, (void **)&punk, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyObject_AsEXPLORER_BROWSER_FILL_FLAGS( obdwFlags, &dwFlags )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->FillFromObject( punk, dwFlags );
if (punk) punk->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod |PyIExplorerBrowser|RemoveAll|Description of RemoveAll.
PyObject *PyIExplorerBrowser::RemoveAll(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":RemoveAll") )
return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->RemoveAll( );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod <o PyIUnknown>|PyIExplorerBrowser|GetCurrentView|Description of GetCurrentView.
PyObject *PyIExplorerBrowser::GetCurrentView(PyObject *self, PyObject *args)
{
IExplorerBrowser *pIEB = GetI(self);
if ( pIEB == NULL )
return NULL;
// @pyparm <o PyIID>|riid||Description for riid
PyObject *obriid;
IID riid;
void *ppv;
if ( !PyArg_ParseTuple(args, "O:GetCurrentView", &obriid) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (!PyWinObject_AsIID(obriid, &riid)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEB->GetCurrentView( riid, &ppv );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEB, IID_IExplorerBrowser );
return PyCom_PyObjectFromIUnknown((IUnknown *)ppv, riid, FALSE);
}
// @object PyIExplorerBrowser|Description of the interface
static struct PyMethodDef PyIExplorerBrowser_methods[] =
{
{ "Initialize", PyIExplorerBrowser::Initialize, 1 }, // @pymeth Initialize|Description of Initialize
{ "Destroy", PyIExplorerBrowser::Destroy, 1 }, // @pymeth Destroy|Description of Destroy
{ "SetRect", PyIExplorerBrowser::SetRect, 1 }, // @pymeth SetRect|Description of SetRect
{ "SetPropertyBag", PyIExplorerBrowser::SetPropertyBag, 1 }, // @pymeth SetPropertyBag|Description of SetPropertyBag
{ "SetEmptyText", PyIExplorerBrowser::SetEmptyText, 1 }, // @pymeth SetEmptyText|Description of SetEmptyText
{ "SetFolderSettings", PyIExplorerBrowser::SetFolderSettings, 1 }, // @pymeth SetFolderSettings|Description of SetFolderSettings
{ "Advise", PyIExplorerBrowser::Advise, 1 }, // @pymeth Advise|Description of Advise
{ "Unadvise", PyIExplorerBrowser::Unadvise, 1 }, // @pymeth Unadvise|Description of Unadvise
{ "SetOptions", PyIExplorerBrowser::SetOptions, 1 }, // @pymeth SetOptions|Description of SetOptions
{ "GetOptions", PyIExplorerBrowser::GetOptions, 1 }, // @pymeth GetOptions|Description of GetOptions
{ "BrowseToIDList", PyIExplorerBrowser::BrowseToIDList, 1 }, // @pymeth BrowseToIDList|Description of BrowseToIDList
{ "BrowseToObject", PyIExplorerBrowser::BrowseToObject, 1 }, // @pymeth BrowseToObject|Description of BrowseToObject
{ "FillFromObject", PyIExplorerBrowser::FillFromObject, 1 }, // @pymeth FillFromObject|Description of FillFromObject
{ "RemoveAll", PyIExplorerBrowser::RemoveAll, 1 }, // @pymeth RemoveAll|Description of RemoveAll
{ "GetCurrentView", PyIExplorerBrowser::GetCurrentView, 1 }, // @pymeth GetCurrentView|Description of GetCurrentView
{ NULL }
};
PyComTypeObject PyIExplorerBrowser::type("PyIExplorerBrowser",
&PyIUnknown::type,
sizeof(PyIExplorerBrowser),
PyIExplorerBrowser_methods,
GET_PYCOM_CTOR(PyIExplorerBrowser));
--- NEW FILE: PyIExplorerCommand.h ---
// This file declares the IExplorerCommand Interface and Gateway for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Interface Declaration
class PyIExplorerCommand : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIExplorerCommand);
static IExplorerCommand *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *GetTitle(PyObject *self, PyObject *args);
static PyObject *GetIcon(PyObject *self, PyObject *args);
static PyObject *GetToolTip(PyObject *self, PyObject *args);
static PyObject *GetCanonicalName(PyObject *self, PyObject *args);
static PyObject *GetState(PyObject *self, PyObject *args);
static PyObject *Invoke(PyObject *self, PyObject *args);
static PyObject *GetFlags(PyObject *self, PyObject *args);
static PyObject *EnumSubCommands(PyObject *self, PyObject *args);
protected:
PyIExplorerCommand(IUnknown *pdisp);
~PyIExplorerCommand();
};
// ---------------------------------------------------
//
// Gateway Declaration
class PyGExplorerCommand : public PyGatewayBase, public IExplorerCommand
{
protected:
PyGExplorerCommand(PyObject *instance) : PyGatewayBase(instance) { ; }
PYGATEWAY_MAKE_SUPPORT2(PyGExplorerCommand, IExplorerCommand, IID_IExplorerCommand, PyGatewayBase)
// IExplorerCommand
STDMETHOD(GetTitle)(
IShellItemArray * psiItemArray,
LPWSTR * ppszName);
STDMETHOD(GetIcon)(
IShellItemArray * psiItemArray,
LPWSTR * ppszIcon);
STDMETHOD(GetToolTip)(
IShellItemArray * psiItemArray,
LPWSTR * ppszInfotip);
STDMETHOD(GetCanonicalName)(
GUID * pguidCommandName);
STDMETHOD(GetState)(
IShellItemArray * psiItemArray,
BOOL fOkToBeSlow,
EXPCMDSTATE * pCmdState);
STDMETHOD(Invoke)(
IShellItemArray * psiItemArray,
IBindCtx * pbc);
STDMETHOD(GetFlags)(
EXPCMDFLAGS * pFlags);
STDMETHOD(EnumSubCommands)(
IEnumExplorerCommand ** ppEnum);
};
--- NEW FILE: PyIExplorerCommand.cpp ---
// This file implements the IExplorerCommand Interface and Gateway for Python.
// Generated by makegw.py
#include "shell_pch.h"
#include "PyIExplorerCommand.h"
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIExplorerCommand::PyIExplorerCommand(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIExplorerCommand::~PyIExplorerCommand()
{
}
/* static */ IExplorerCommand *PyIExplorerCommand::GetI(PyObject *self)
{
return (IExplorerCommand *)PyIUnknown::GetI(self);
}
// @pymethod unicode|PyIExplorerCommand|GetTitle|Description of GetTitle.
PyObject *PyIExplorerCommand::GetTitle(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
// @pyparm <o PyIShellItemArray *>|psiItemArray||Description for psiItemArray
PyObject *obpsiItemArray;
IShellItemArray * psiItemArray;
if ( !PyArg_ParseTuple(args, "O:GetTitle", &obpsiItemArray) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
WCHAR *pszName = 0;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEC->GetTitle( psiItemArray, &pszName );
if (psiItemArray) psiItemArray->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
PyObject *ret = PyWinObject_FromWCHAR(pszName);
CoTaskMemFree(pszName);
return ret;
}
// @pymethod unicode|PyIExplorerCommand|GetIcon|Description of GetIcon.
PyObject *PyIExplorerCommand::GetIcon(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
// @pyparm <o PyIShellItemArray *>|psiItemArray||Description for psiItemArray
PyObject *obpsiItemArray;
IShellItemArray * psiItemArray;
if ( !PyArg_ParseTuple(args, "O:GetIcon", &obpsiItemArray) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
WCHAR *pszIcon = 0;
PY_INTERFACE_PRECALL;
hr = pIEC->GetIcon( psiItemArray, &pszIcon );
if (psiItemArray) psiItemArray->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
PyObject *ret = PyWinObject_FromWCHAR(pszIcon);
CoTaskMemFree(pszIcon);
return ret;
}
// @pymethod unicode|PyIExplorerCommand|GetToolTip|Description of GetToolTip.
PyObject *PyIExplorerCommand::GetToolTip(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
// @pyparm <o PyIShellItemArray *>|psiItemArray||Description for psiItemArray
PyObject *obpsiItemArray;
IShellItemArray * psiItemArray;
if ( !PyArg_ParseTuple(args, "O:GetToolTip", &obpsiItemArray) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
WCHAR *psz = 0;
PY_INTERFACE_PRECALL;
hr = pIEC->GetToolTip(psiItemArray, &psz);
if (psiItemArray) psiItemArray->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
PyObject *ret = PyWinObject_FromWCHAR(psz);
CoTaskMemFree(psz);
return ret;
}
// @pymethod <o PyIID>|PyIExplorerCommand|GetCanonicalName|Description of GetCanonicalName.
PyObject *PyIExplorerCommand::GetCanonicalName(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":GetCanonicalName") )
return NULL;
BOOL bPythonIsHappy = TRUE;
GUID guid;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEC->GetCanonicalName( &guid );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
return PyWinObject_FromIID(guid);
}
// @pymethod int|PyIExplorerCommand|GetState|Description of GetState.
PyObject *PyIExplorerCommand::GetState(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
// @pyparm <o PyIShellItemArray *>|psiItemArray||Description for psiItemArray
// @pyparm int|fOkToBeSlow||Description for fOkToBeSlow
PyObject *obpsiItemArray;
IShellItemArray* psiItemArray;
BOOL fOkToBeSlow;
if ( !PyArg_ParseTuple(args, "Oi:GetState", &obpsiItemArray, &fOkToBeSlow) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
DWORD cmdState;
PY_INTERFACE_PRECALL;
hr = pIEC->GetState(psiItemArray, fOkToBeSlow, &cmdState );
if (psiItemArray) psiItemArray->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
return PyLong_FromUnsignedLong(cmdState);
}
// @pymethod |PyIExplorerCommand|Invoke|Description of Invoke.
PyObject *PyIExplorerCommand::Invoke(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
// @pyparm <o PyIShellItemArray *>|psiItemArray||Description for psiItemArray
// @pyparm <o PyIBindCtx *>|pbc||Description for pbc
PyObject *obpsiItemArray;
PyObject *obpbc;
IShellItemArray *psiItemArray;
IBindCtx *pbc;
if ( !PyArg_ParseTuple(args, "OO:Invoke", &obpsiItemArray, &obpbc) )
return NULL;
BOOL bPythonIsHappy = TRUE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpsiItemArray, IID_IShellItemArray, (void **)&psiItemArray, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyCom_InterfaceFromPyInstanceOrObject(obpbc, IID_IBindCtx, (void **)&pbc, TRUE /* bNoneOK */))
bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEC->Invoke( psiItemArray, pbc );
if (psiItemArray) psiItemArray->Release();
if (pbc) pbc->Release();
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
Py_INCREF(Py_None);
return Py_None;
}
// @pymethod int|PyIExplorerCommand|GetFlags|Description of GetFlags.
PyObject *PyIExplorerCommand::GetFlags(PyObject *self, PyObject *args)
{
IExplorerCommand *pIEC = GetI(self);
if ( pIEC == NULL )
return NULL;
if ( !PyArg_ParseTuple(args, ":GetFlags") )
return NULL;
HRESULT hr;
DWORD flags;
PY_INTERFACE_PRECALL;
hr = pIEC->GetFlags( &flags );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEC, IID_IExplorerCommand );
return PyLong_FromUnsignedLong(flags);
}
// @pymethod <o PyIEnumExplorerCommand>|PyIExplorerCommand|EnumSubCommands|Description of EnumSubCommands.
PyObject *PyIExplorerCommand::EnumSubCommands(PyObject *self, PyObject *args)
{
...
[truncated message content] |