// @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 |PyIDocHostUIHandler|EnableModeless|Description of EnableModeless. PyObject *PyIDocHostUIHandler::EnableModeless(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fEnable||Description for fEnable BOOL fEnable; if ( !PyArg_ParseTuple(args, "i:EnableModeless", &fEnable) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->EnableModeless( fEnable ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); }
// @pymethod int|PyIPropertyDescriptionList|GetCount|Gets the number of properties in the list PyObject *PyIPropertyDescriptionList::GetCount(PyObject *self, PyObject *args) { IPropertyDescriptionList *pIPDL = GetI(self); if ( pIPDL == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":GetCount")) return NULL; UINT cnt; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIPDL->GetCount(&cnt); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPDL, IID_IPropertyDescriptionList ); return PyLong_FromUnsignedLong(cnt); }
// @pymethod <o PyIEnumResources>|PyIShellItemResources|EnumResources|Description of EnumResources. PyObject *PyIShellItemResources::EnumResources(PyObject *self, PyObject *args) { IShellItemResources *pISIR = GetI(self); if ( pISIR == NULL ) return NULL; IEnumResources *penumr; if ( !PyArg_ParseTuple(args, ":EnumResources")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIR->EnumResources(&penumr); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIR, IID_IShellItemResources); return PyCom_PyObjectFromIUnknown(penumr, IID_IEnumResources, FALSE); }
// @pymethod |PyIBackgroundCopyJob|Complete|Description of Complete. PyObject *PyIBackgroundCopyJob::Complete(PyObject *self, PyObject *args) { IBackgroundCopyJob *pIBCJ = GetI(self); if ( pIBCJ == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":Complete") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIBCJ->Complete( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIBCJ, IID_IBackgroundCopyJob ); return PyInt_FromLong(hr); }
// A DAO hack! // @pymethod <o PyIDispatch>|win32uiole|DaoGetEngine| static PyObject *DaoGetEngine(PyObject *self, PyObject *args) { CHECK_NO_ARGS2(args, "DaoGetEngine"); # ifdef _M_X64 return NULL; # else AfxDaoInit(); DAODBEngine* pEngine = AfxDaoGetEngine(); IDispatch *pDisp; HRESULT hr = pEngine->QueryInterface(IID_IDispatch, (void **)&pDisp); if (FAILED(hr)) return PyCom_BuildPyException(hr); pEngine->Release(); return PyCom_PyObjectFromIUnknown(pDisp, IID_IDispatch, FALSE); #endif }
// @pymethod |PyINameSpaceTreeControl|GetRootItems|Description of GetRootItems. PyObject *PyINameSpaceTreeControl::GetRootItems(PyObject *self, PyObject *args) { INameSpaceTreeControl *pINSTC = GetI(self); if ( pINSTC == NULL ) return NULL; IShellItemArray * ppsiaRootItems; if ( !PyArg_ParseTuple(args, ":GetRootItems") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pINSTC->GetRootItems( &ppsiaRootItems ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pINSTC, IID_INameSpaceTreeControl ); return PyCom_PyObjectFromIUnknown(ppsiaRootItems, IID_IShellItemArray, FALSE); }
// @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 str|PyIShellLibrary|GetIcon|Returns the location of the library's icon // @rdesc Uses "module,resource" format PyObject *PyIShellLibrary::GetIcon(PyObject *self, PyObject *args) { IShellLibrary *pISL = GetI(self); if ( pISL == NULL ) return NULL; LPWSTR Icon; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISL->GetIcon(&Icon); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISL, IID_IShellLibrary ); PyObject *ret = PyWinObject_FromWCHAR(Icon); CoTaskMemFree(Icon); // Docs don't specify, but this doesn't leak return ret; }
// @pymethod <o PyIID>|pythoncom|ReadClassStm|Retrieves the CLSID from a stream PyObject *pythoncom_ReadClassStm(PyObject *self, PyObject *args) { PyObject *obStm; if (!PyArg_ParseTuple(args, "O:ReadClassStm", &obStm)) // @pyparm <o PyIStream>|Stm||An IStream interface return NULL; IStream *pStm; if (!PyCom_InterfaceFromPyObject(obStm, IID_IStream, (void **)&pStm, FALSE)) return NULL; CLSID clsidRet; PY_INTERFACE_PRECALL; HRESULT hr = ReadClassStm(pStm, &clsidRet); pStm->Release(); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); return PyWinObject_FromIID(clsidRet); }
// @pymethod tuple|PyIPropertyStorage|Stat|Returns various infomation about the property set // @rdesc Returns a tuple representing a STATPROPSETSTG struct. PyObject *PyIPropertyStorage::Stat(PyObject *self, PyObject *args) { IPropertyStorage *pIPS = GetI(self); if ( pIPS == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":Stat") ) return NULL; STATPROPSETSTG p; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIPS->Stat( &p ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); return PyCom_PyObjectFromSTATPROPSETSTG(&p); }
// @pymethod |PyIServerSecurity|RevertToSelf|Ends impersonation of client PyObject *PyIServerSecurity::RevertToSelf(PyObject *self, PyObject *args) { IServerSecurity *pISS = GetI(self); if ( pISS == NULL ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISS->RevertToSelf( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISS, IID_IServerSecurity ); Py_INCREF(Py_None); return Py_None; }
// @pymethod <o PyIID>|pythoncom|ReadClassStg|Reads a CLSID from a storage object. PyObject *pythoncom_ReadClassStg(PyObject *self, PyObject *args) { PyObject *obStg; if (!PyArg_ParseTuple(args, "O:ReadClassStg", &obStg)) // @pyparm <o PyIStorage>|storage||The storage to read the CLSID from. return NULL; IStorage *pStorage; if (!PyCom_InterfaceFromPyObject(obStg, IID_IStorage, (void **)&pStorage, FALSE)) return NULL; CLSID clsidRet; PY_INTERFACE_PRECALL; HRESULT hr = ReadClassStg(pStorage, &clsidRet); pStorage->Release(); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); return PyWinObject_FromIID(clsidRet); }
// @pymethod int|PyIShellItemResources|GetSize|Description of GetSize. PyObject *PyIShellItemResources::GetSize(PyObject *self, PyObject *args) { IShellItemResources *pISIR = GetI(self); if ( pISIR == NULL ) return NULL; ULONGLONG ullSize; if ( !PyArg_ParseTuple(args, ":GetSize")) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIR->GetSize(&ullSize ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIR, IID_IShellItemResources ); return PyLong_FromUnsignedLongLong(ullSize); }
// @pymethod |PyIShellItemResources|GetAttributes|Description of GetAttributes. PyObject *PyIShellItemResources::GetAttributes(PyObject *self, PyObject *args) { IShellItemResources *pISIR = GetI(self); if ( pISIR == NULL ) return NULL; DWORD dwAttributes; if ( !PyArg_ParseTuple(args, ":GetAttributes") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIR->GetAttributes( &dwAttributes ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIR, IID_IShellItemResources ); return PyLong_FromUnsignedLong(dwAttributes); }
// @pymethod |PyIShellItemResources|MarkForDelete|Description of MarkForDelete. PyObject *PyIShellItemResources::MarkForDelete(PyObject *self, PyObject *args) { IShellItemResources *pISIR = GetI(self); if ( pISIR == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":MarkForDelete") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pISIR->MarkForDelete( ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pISIR, IID_IShellItemResources ); Py_INCREF(Py_None); return Py_None; }
// @pymethod |PyIBackgroundCopyJob|GetError|Description of GetError. PyObject *PyIBackgroundCopyJob::GetError(PyObject *self, PyObject *args) { IBackgroundCopyJob *pIBCJ = GetI(self); if ( pIBCJ == NULL ) return NULL; IBackgroundCopyError * ppError; if ( !PyArg_ParseTuple(args, ":GetError") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIBCJ->GetError( &ppError ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIBCJ, IID_IBackgroundCopyJob ); return PyCom_PyObjectFromIUnknown(ppError, IID_IBackgroundCopyError, FALSE); }
// @pymethod |PyIBackgroundCopyJob2|GetReplyProgress|Description of GetReplyProgress. PyObject *PyIBackgroundCopyJob2::GetReplyProgress(PyObject *self, PyObject *args) { IBackgroundCopyJob2 *pIBCJ2 = GetI(self); if ( pIBCJ2 == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":GetReplyProgress") ) return NULL; HRESULT hr; BG_JOB_REPLY_PROGRESS progress; PY_INTERFACE_PRECALL; hr = pIBCJ2->GetReplyProgress( &progress ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIBCJ2, IID_IBackgroundCopyJob2 ); return PyObject_FromBG_JOB_REPLY_PROGRESS(&progress); }
// @pymethod <o PyIEnumSTATPROPSTG>|PyIPropertyStorage|Enum|Creates an enumerator for properties in the property set PyObject *PyIPropertyStorage::Enum(PyObject *self, PyObject *args) { IPropertyStorage *pIPS = GetI(self); if ( pIPS == NULL ) return NULL; IEnumSTATPROPSTG * ppenum; if ( !PyArg_ParseTuple(args, ":Enum") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIPS->Enum( &ppenum ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPS, IID_IPropertyStorage); return PyCom_PyObjectFromIUnknown(ppenum, IID_IEnumSTATPROPSTG, FALSE); }
// @pymethod |PyICategoryProvider|GetDefaultCategory|Description of GetDefaultCategory. PyObject *PyICategoryProvider::GetDefaultCategory(PyObject *self, PyObject *args) { ICategoryProvider *pICP = GetI(self); if ( pICP == NULL ) return NULL; if ( !PyArg_ParseTuple(args, ":GetDefaultCategory") ) return NULL; HRESULT hr; GUID guid = __uuidof(NULL); SHCOLUMNID scid; PY_INTERFACE_PRECALL; hr = pICP->GetDefaultCategory( &guid, &scid ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pICP, IID_ICategoryProvider ); return Py_BuildValue("NN", PyWinObject_FromIID(guid), PyObject_FromSHCOLUMNID(&scid)); }
// @pymethod <o PyIUnknown>|PyIMoniker|BindToObject|Uses the moniker to bind to the object it identifies. PyObject *PyIMoniker::BindToObject(PyObject *self, PyObject *args) { // @pyparm <o PyIBindCtx>|bindCtx||bind context object to be used. // @pyparm <o PyIMoniker>|moniker||If the moniker is part of a composite moniker, otherwise None // @pyparm <o IID>|iidResult||IID of the result object. PyObject *obBindCtx; PyObject *obMoniker; PyObject *obIID; if (!PyArg_ParseTuple(args, "OOO:BindToObject", &obBindCtx, &obMoniker, &obIID)) return NULL; IMoniker *pMy = GetI(self); if (pMy==NULL) return NULL; IBindCtx *pBindCtx; if (!PyCom_InterfaceFromPyInstanceOrObject(obBindCtx, IID_IBindCtx, (void **)&pBindCtx, FALSE)) return NULL; IMoniker *pMonLeft = NULL; if (obMoniker!=Py_None) { if (!PyCom_InterfaceFromPyInstanceOrObject(obMoniker, IID_IMoniker, (void **)&pMonLeft, FALSE)) { PYCOM_RELEASE(pBindCtx); return NULL; } } IID iid; if (!PyWinObject_AsIID(obIID, &iid)) { PY_INTERFACE_PRECALL; pBindCtx->Release(); if (pMonLeft) pMonLeft->Release(); PY_INTERFACE_POSTCALL; return NULL; } void *pResult = NULL; PY_INTERFACE_PRECALL; HRESULT hr = pMy->BindToObject(pBindCtx, pMonLeft, iid, &pResult ); pBindCtx->Release(); if (pMonLeft) pMonLeft->Release(); PY_INTERFACE_POSTCALL; if (S_OK!=hr) // S_OK only acceptable return PyCom_BuildPyException(hr, pMy, IID_IMoniker); return PyCom_PyObjectFromIUnknown((IUnknown *)pResult, iid, FALSE ); }
// @pymethod |PyIDocHostUIHandler|OnFrameWindowActivate|Description of OnFrameWindowActivate. PyObject *PyIDocHostUIHandler::OnFrameWindowActivate(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; // @pyparm int|fActivate||Description for fActivate BOOL fActivate; if ( !PyArg_ParseTuple(args, "i:OnFrameWindowActivate", &fActivate) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->OnFrameWindowActivate( fActivate ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); }
// @pymethod |PyIStorage|SetElementTimes|Sets the modification, access, and creation times of the specified storage element, if supported by the underlying file system. PyObject *PyIStorage::SetElementTimes(PyObject *self, PyObject *args) { IStorage *pIS = GetI(self); if ( pIS == NULL ) return NULL; // @pyparm string|name||The name of the storage object element whose times are to be modified. If NULL, the time is set on the root storage rather than one of its elements. // @pyparm <o PyTime>|ctime||Either the new creation time for the element or None if the creation time is not to be modified. // @pyparm <o PyTime>|atime||Either the new access time for the element or None if the access time is not to be modified. // @pyparm <o PyTime>|mtime||Either the new modification time for the element or None if the modification time is not to be modified. PyObject *obName; PyObject *obpctime; PyObject *obpatime; PyObject *obpmtime; if ( !PyArg_ParseTuple(args, "OOOO:SetElementTimes", &obName, &obpctime, &obpatime, &obpmtime) ) return NULL; FILETIME *pctime=NULL, ctime; FILETIME *patime=NULL, atime; FILETIME *pmtime=NULL, mtime; if (obpctime!=Py_None) { if (!PyWinObject_AsFILETIME(obpctime, &ctime)) return NULL; pctime = &ctime; } if (obpatime != Py_None) { if (!PyWinObject_AsFILETIME(obpatime, &atime)) return NULL; patime = &atime; } if (obpmtime != Py_None) { if (!PyWinObject_AsFILETIME(obpmtime, &mtime)) return NULL; pmtime = &mtime; } BSTR bstrName; if (!PyWinObject_AsBstr(obName, &bstrName)) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIS->SetElementTimes( bstrName, pctime, patime, pmtime ); PyWinObject_FreeBstr(bstrName); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIS, IID_IStorage); Py_INCREF(Py_None); return Py_None; }
// @pymethod |PyIEnumBackgroundCopyJobs|Reset|Resets the enumeration sequence to the beginning. PyObject *PyIEnumBackgroundCopyJobs::Reset(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Reset") ) return NULL; IEnumBackgroundCopyJobs *pIEnumBackgroundCopyJobs = GetI(self); if ( pIEnumBackgroundCopyJobs == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIEnumBackgroundCopyJobs->Reset(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIEnumBackgroundCopyJobs, IID_IEnumBackgroundCopyJobs); Py_INCREF(Py_None); return Py_None; }
// @pymethod <o PyIEnumBackgroundCopyJobs>|PyIEnumBackgroundCopyJobs|Clone|Creates another enumerator that contains the same enumeration state as the current one PyObject *PyIEnumBackgroundCopyJobs::Clone(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Clone") ) return NULL; IEnumBackgroundCopyJobs *pIEnumBackgroundCopyJobs = GetI(self); if ( pIEnumBackgroundCopyJobs == NULL ) return NULL; IEnumBackgroundCopyJobs *pClone; PY_INTERFACE_PRECALL; HRESULT hr = pIEnumBackgroundCopyJobs->Clone(&pClone); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIEnumBackgroundCopyJobs, IID_IEnumBackgroundCopyJobs); return PyCom_PyObjectFromIUnknown(pClone, IID_IEnumBackgroundCopyJobs, FALSE); }
// @pymethod |PyIEnumConnectionPoints|Reset|Resets the enumeration sequence to the beginning. PyObject *PyIEnumConnectionPoints::Reset(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Reset") ) return NULL; IEnumConnectionPoints *pIEConnections = GetI(self); if ( pIEConnections == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIEConnections->Reset(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr); Py_INCREF(Py_None); return Py_None; }
// @pymethod <o PyIShellItem>|PyIShellItem|GetParent|Retrieves the parent of this item 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 |PyIEnumMoniker|Skip|Skips over the next specified elementes. PyObject *PyIEnumMoniker::Skip(PyObject *self, PyObject *args) { ULONG num; // @pyparm int|num||The number of elements being requested. if (!PyArg_ParseTuple(args, "l:Skip", &num)) return NULL; IEnumMoniker *pMy = GetI(self); if (pMy==NULL) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pMy->Skip(num); PY_INTERFACE_POSTCALL; if (FAILED(hr)) return PyCom_BuildPyException(hr); Py_INCREF(Py_None); return Py_None; }
// @pymethod |PyIPersistStreamInit|InitNew|Initializes the object to a default state. PyObject *PyIPersistStreamInit::InitNew(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":InitNew") ) return NULL; IPersistStreamInit *pIPSI = GetI(self); if ( pIPSI == NULL ) return NULL; PY_INTERFACE_PRECALL; HRESULT hr = pIPSI->InitNew(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIPSI, IID_IPersistStreamInit); Py_INCREF(Py_None); return Py_None; }
// @pymethod <o PyIEnumIDList>|PyIEnumIDList|Clone|Creates another enumerator that contains the same enumeration state as the current one PyObject *PyIEnumIDList::Clone(PyObject *self, PyObject *args) { if ( !PyArg_ParseTuple(args, ":Clone") ) return NULL; IEnumIDList *peidl = GetI(self); if ( peidl == NULL ) return NULL; IEnumIDList *pClone; PY_INTERFACE_PRECALL; HRESULT hr = peidl->Clone(&pClone); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, peidl, IID_IEnumIDList); return PyCom_PyObjectFromIUnknown(pClone, IID_IEnumIDList, FALSE); }