Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9833
Modified Files:
PyIShellBrowser.cpp
Log Message:
IShellFolder.ParseDisplayName now takes an extra param - this may break
some servers (but the old code did not provide a critical param, so could
not work correctly
Index: PyIShellBrowser.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellBrowser.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** PyIShellBrowser.cpp 9 Apr 2004 11:15:10 -0000 1.3
--- PyIShellBrowser.cpp 26 May 2004 08:57:02 -0000 1.4
***************
*** 12,15 ****
--- 12,18 ----
PyObject *PyObject_FromOLEMENUGROUPWIDTHS(OLEMENUGROUPWIDTHS *p);
+ extern BOOL PyObject_AsTBBUTTONs( PyObject *ob, TBBUTTON **ppButtons, UINT *nButtons );
+ extern void PyObject_FreeTBBUTTONs(TBBUTTON *);
+
// Interface Implementation
***************
*** 264,267 ****
--- 267,301 ----
}
+ // Little helper stolen from win32gui
+ static BOOL make_param(PyObject *ob, long *pl)
+ {
+ long &l = *pl;
+ if (ob==NULL || ob==Py_None)
+ l = 0;
+ else
+ #ifdef UNICODE
+ #define TCHAR_DESC "Unicode"
+ if (PyUnicode_Check(ob))
+ l = (long)PyUnicode_AsUnicode(ob);
+ #else
+ #define TCHAR_DESC "String"
+ if (PyString_Check(ob))
+ l = (long)PyString_AsString(ob);
+ #endif
+ else if (PyInt_Check(ob))
+ l = PyInt_AsLong(ob);
+ else {
+ PyBufferProcs *pb = ob->ob_type->tp_as_buffer;
+ if (pb != NULL && pb->bf_getreadbuffer) {
+ if(-1 == pb->bf_getreadbuffer(ob,0,(void **) &l))
+ return FALSE;
+ } else {
+ PyErr_SetString(PyExc_TypeError, "Must be a" TCHAR_DESC ", int, or buffer object");
+ return FALSE;
+ }
+ }
+ return TRUE;
+ }
+
// @pymethod |PyIShellBrowser|SendControlMsg|Description of SendControlMsg.
PyObject *PyIShellBrowser::SendControlMsg(PyObject *self, PyObject *args)
***************
*** 276,283 ****
UINT id;
UINT uMsg;
WPARAM wParam;
LPARAM lParam;
! if ( !PyArg_ParseTuple(args, "iiil:SendControlMsg", &id, &uMsg, &wParam, &lParam) )
return NULL;
HRESULT hr;
LRESULT ret;
--- 310,323 ----
UINT id;
UINT uMsg;
+ PyObject *obwparam, *oblparam;
+ if ( !PyArg_ParseTuple(args, "iiOO:SendControlMsg", &id, &uMsg, &obwparam, &oblparam) )
+ return NULL;
WPARAM wParam;
LPARAM lParam;
! if (!make_param(obwparam, (long *)&wParam))
return NULL;
+ if (!make_param(oblparam, (long *)&lParam))
+ return NULL;
+
HRESULT hr;
LRESULT ret;
***************
*** 335,339 ****
}
- /*
// @pymethod |PyIShellBrowser|SetToolbarItems|Description of SetToolbarItems.
PyObject *PyIShellBrowser::SetToolbarItems(PyObject *self, PyObject *args)
--- 375,378 ----
***************
*** 342,364 ****
if ( pISB == NULL )
return NULL;
- // *** The input argument lpButtons of type "LPTBBUTTONSB" was not processed ***
- // Please check the conversion function is appropriate and exists!
LPTBBUTTONSB lpButtons;
PyObject *oblpButtons;
// @pyparm <o PyLPTBBUTTONSB>|lpButtons||Description for lpButtons
- // @pyparm int|nButtons||Description for nButtons
// @pyparm int|uFlags||Description for uFlags
UINT nButtons;
UINT uFlags;
! if ( !PyArg_ParseTuple(args, "Oii:SetToolbarItems", &oblpButtons, &nButtons, &uFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
! if (bPythonIsHappy && !PyObject_AsLPTBBUTTONSB( oblpButtons, &lpButtons )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISB->SetToolbarItems( lpButtons, nButtons, uFlags );
! PyObject_FreeLPTBBUTTONSB(lpButtons);
!
PY_INTERFACE_POSTCALL;
--- 381,399 ----
if ( pISB == NULL )
return NULL;
LPTBBUTTONSB lpButtons;
PyObject *oblpButtons;
// @pyparm <o PyLPTBBUTTONSB>|lpButtons||Description for lpButtons
// @pyparm int|uFlags||Description for uFlags
UINT nButtons;
UINT uFlags;
! if ( !PyArg_ParseTuple(args, "Oi:SetToolbarItems", &oblpButtons, &uFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
! if (bPythonIsHappy && !PyObject_AsTBBUTTONs( oblpButtons, &lpButtons, &nButtons )) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pISB->SetToolbarItems( lpButtons, nButtons, uFlags );
! PyObject_FreeTBBUTTONs(lpButtons);
PY_INTERFACE_POSTCALL;
***************
*** 369,374 ****
}
! */
! // @object PyIShellBrowser|Description of the interface
static struct PyMethodDef PyIShellBrowser_methods[] =
{
--- 404,408 ----
}
!
static struct PyMethodDef PyIShellBrowser_methods[] =
{
***************
*** 385,388 ****
--- 419,423 ----
{ "QueryActiveShellView", PyIShellBrowser::QueryActiveShellView, 1 }, // @pymeth QueryActiveShellView|Description of QueryActiveShellView
{ "OnViewWindowActive", PyIShellBrowser::OnViewWindowActive, 1 }, // @pymeth OnViewWindowActive|Description of OnViewWindowActive
+ { "SetToolbarItems", PyIShellBrowser::SetToolbarItems, 1}, // @pymeth SetToolbarItems|Description of OnViewWindowActive
{ NULL }
};
|