コード例 #1
0
STDMETHODIMP PyGShellView::SelectItem(
		/* [in] */ LPCITEMIDLIST pidlItem,
		/* [in] */ SVSIF uFlags)
{
	PY_GATEWAY_METHOD;
	PyObject *obpidlItem;
	obpidlItem = PyObject_FromPIDL(pidlItem, FALSE);
	HRESULT hr=InvokeViaPolicy("SelectItem", NULL, "Oi", obpidlItem, uFlags);
	Py_XDECREF(obpidlItem);
	return hr;
}
コード例 #2
0
ファイル: PyIShellBrowser.cpp プロジェクト: malrsrch/pywin32
STDMETHODIMP PyGShellBrowser::BrowseObject(
		/* [in] */ LPCITEMIDLIST pidl,
		/* [in] */ UINT wFlags)
{
	PY_GATEWAY_METHOD;
	PyObject *obpidl;
	obpidl = PyObject_FromPIDL(pidl, FALSE);
	HRESULT hr=InvokeViaPolicy("BrowseObject", NULL, "OI", obpidl, wFlags);
	Py_XDECREF(obpidl);
	return hr;
}
コード例 #3
0
ファイル: PyIEnumIDList.cpp プロジェクト: malrsrch/pywin32
// @pymethod object|PyIEnumIDList|Next|Retrieves a specified number of items in the enumeration sequence.
PyObject *PyIEnumIDList::Next(PyObject *self, PyObject *args)
{
	long celt = 1;
	// @pyparm int|num|1|Number of items to retrieve.
	if ( !PyArg_ParseTuple(args, "|l:Next", &celt) )
		return NULL;

	IEnumIDList *peidl = GetI(self);
	if ( peidl == NULL )
		return NULL;

	LPITEMIDLIST *rgVar = new LPITEMIDLIST [celt];
	if ( rgVar == NULL ) {
		PyErr_SetString(PyExc_MemoryError, "allocating result ITEMIDLISTs");
		return NULL;
	}
	memset(rgVar, 0, sizeof(ITEMIDLIST *) * celt);

	int i;
/*	for ( i = celt; i--; )
		// *** possibly init each structure element???
*/

	ULONG celtFetched = 0;
	PY_INTERFACE_PRECALL;
	HRESULT hr = peidl->Next(celt, rgVar, &celtFetched);
	PY_INTERFACE_POSTCALL;
	if (  HRESULT_CODE(hr) != ERROR_NO_MORE_ITEMS && FAILED(hr) )
	{
		delete [] rgVar;
		return PyCom_BuildPyException(hr,peidl, IID_IEnumIDList);
	}

	PyObject *result = PyList_New(celtFetched);
	if ( result != NULL )
	{
		for ( i = celtFetched; i--; )
		{
			PyObject *ob = PyObject_FromPIDL(rgVar[i], TRUE);
			if ( ob == NULL )
			{
				Py_DECREF(result);
				result = NULL;
				break;
			}
			PyList_SET_ITEM(result, i, ob);
		}
	}

	// Each item free'd by PyObject_FromPIDL'd TRUE param
	delete [] rgVar;
	return result;
}
コード例 #4
0
// @pymethod |PyIPersistFolder2|GetCurFolder|Description of GetCurFolder.
PyObject *PyIPersistFolder2::GetCurFolder(PyObject *self, PyObject *args)
{
	IPersistFolder2 *pIPF2 = GetI(self);
	if ( pIPF2 == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":GetCurFolder") )
		return NULL;
	HRESULT hr;
	PIDLIST_ABSOLUTE pidl;
	PY_INTERFACE_PRECALL;
	hr = pIPF2->GetCurFolder( &pidl );
	PY_INTERFACE_POSTCALL;
	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIPF2, IID_IPersistFolder2 );
	return PyObject_FromPIDL(pidl, TRUE);
}
コード例 #5
0
// @pymethod <o PyIDL>|PyIShellLink|GetIDList|Retrieves the item id list that identifies the target of the shell link.
PyObject *PyIShellLink::GetIDList(PyObject *self, PyObject *args)
{
	IShellLink *pISL = GetI(self);
	if ( pISL == NULL )
		return NULL;
	if ( !PyArg_ParseTuple(args, ":GetIDList") )
		return NULL;
	HRESULT hr;
	LPITEMIDLIST pidl = NULL;
	PY_INTERFACE_PRECALL;
	hr = pISL->GetIDList( &pidl );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return OleSetOleError(hr);
	return PyObject_FromPIDL(pidl, TRUE);
}
コード例 #6
0
// @pymethod <o PyIDL>|PyIRelatedItem|GetItemIDList|Returns the ID list of the related item
PyObject *PyIRelatedItem::GetItemIDList(PyObject *self, PyObject *args)
{
	IRelatedItem *pIRI = GetI(self);
	if ( pIRI == NULL )
		return NULL;
	PIDLIST_ABSOLUTE pidl;
	PyObject *obppidl;
	if ( !PyArg_ParseTuple(args, ":GetItemIDList", &obppidl) )
		return NULL;
	HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pIRI->GetItemIDList( &pidl );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr, pIRI, IID_IRelatedItem );
	return PyObject_FromPIDL(pidl, TRUE);
}