Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14624/com/win32comext/shell/src
Modified Files:
shell.cpp
Added Files:
PyIExtractImage.cpp PyIExtractImage.h
Log Message:
IExtractImage from Steven James.
--- NEW FILE: PyIExtractImage.cpp ---
// This file implements the IExtractImage Interface for Python.
// Generated by makegw.py
#include "shell_pch.h"
#include "PyWinTypes.h"
#include "PyIExtractImage.h"
#define elementsof( array ) ( sizeof(array) / sizeof((array)[0]) )
BOOL PyWinObject_AsSIZE(PyObject *obsize, SIZE *psize);
PyObject *PyWinObject_FromSIZE(PSIZE psize);
PyObject *PyWinObject_FromSIZE(PSIZE psize)
{
return Py_BuildValue("ll", psize->cx, psize->cy);
}
BOOL PyWinObject_AsSIZE(PyObject *obsize, SIZE *psize)
{
if (!PyTuple_Check(obsize)){
PyErr_SetString(PyExc_TypeError, "SIZE must be a tuple of 2 ints (x,y)");
return FALSE;
}
return PyArg_ParseTuple(obsize, "ll;SIZE must be a tuple of 2 ints (x,y)",
&psize->cx, &psize->cy);
}
// @doc - This file contains autoduck documentation
// ---------------------------------------------------
//
// Interface Implementation
PyIExtractImage::PyIExtractImage(IUnknown *pdisp):
PyIUnknown(pdisp)
{
ob_type = &type;
}
PyIExtractImage::~PyIExtractImage()
{
}
/* static */ IExtractImage *PyIExtractImage::GetI(PyObject *self)
{
return (IExtractImage *)PyIUnknown::GetI(self);
}
// @pymethod |PyIExtractImage|GetLocation|Description of GetLocation.
PyObject *PyIExtractImage::GetLocation(PyObject *self, PyObject *args)
{
IExtractImage *pIEI = GetI(self);
if ( pIEI == NULL )
return NULL;
DWORD dwPriority;
//PyObject *obdwPriority;
// @pyparm <o PyDWORD *>|dwPriority||Description for dwPriority
SIZE rgSize;
PyObject *obrgSize;
// @pyparm <o Pyconst SIZE *>|prgSize||Description for prgSize
// @pyparm int|dwRecClrDepth||Description for dwRecClrDepth
DWORD dwFlags;
//PyObject *obdwFlags;
// @pyparm <o PyDWORD *>|pdwFlags||Description for pdwFlags
WCHAR pszPathBuffer[255];
DWORD dwRecClrDepth;
if ( !PyArg_ParseTuple(args, "lOll:GetLocation", &dwPriority, &obrgSize, &dwRecClrDepth, &dwFlags) )
return NULL;
BOOL bPythonIsHappy = TRUE;
//if (bPythonIsHappy && !PyInt_Check(obdwPriority)) bPythonIsHappy = FALSE;
if (bPythonIsHappy && !PyWinObject_AsSIZE ( obrgSize, &rgSize )) bPythonIsHappy = FALSE;
//if (bPythonIsHappy && !PyInt_Check(obdwFlags)) bPythonIsHappy = FALSE;
if (!bPythonIsHappy) return NULL;
//dwPriority = PyInt_AsLong(obdwPriority);
//dwFlags = PyInt_AsLong(obdwFlags);
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEI->GetLocation( pszPathBuffer, elementsof(pszPathBuffer), &dwPriority, &rgSize, dwRecClrDepth, &dwFlags );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEI, IID_IExtractImage );
PyObject *obpszPathBuffer;
obpszPathBuffer = MakeOLECHARToObj(pszPathBuffer);
PyObject *pyretval = Py_BuildValue("O", obpszPathBuffer);
CoTaskMemFree(pszPathBuffer);
Py_XDECREF(obpszPathBuffer);
return pyretval;
}
// @pymethod |PyIExtractImage|Extract|Description of Extract.
PyObject *PyIExtractImage::Extract(PyObject *self, PyObject *args)
{
IExtractImage *pIEI = GetI(self);
if ( pIEI == NULL )
return NULL;
HBITMAP hBmpThumbnail;
HRESULT hr;
PY_INTERFACE_PRECALL;
hr = pIEI->Extract( &hBmpThumbnail );
PY_INTERFACE_POSTCALL;
if ( FAILED(hr) )
return PyCom_BuildPyException(hr, pIEI, IID_IExtractImage );
return PyWinObject_FromHANDLE((HANDLE)hBmpThumbnail);
//return Py_BuildValue("i", hBmpThumbnail);
//return PyLong_FromVoidPtr((void*)hBmpThumbnail);
//return PyString_FromString((char*)hBmpThumbnail);
}
// @object PyIExtractImage|Description of the interface
static struct PyMethodDef PyIExtractImage_methods[] =
{
{ "GetLocation", PyIExtractImage::GetLocation, 1 }, // @pymeth GetLocation|Description of GetLocation
{ "Extract", PyIExtractImage::Extract, 1 }, // @pymeth Extract|Description of Extract
{ NULL }
};
PyComTypeObject PyIExtractImage::type("PyIExtractImage",
&PyIUnknown::type,
sizeof(PyIExtractImage),
PyIExtractImage_methods,
GET_PYCOM_CTOR(PyIExtractImage));
--- NEW FILE: PyIExtractImage.h ---
// This file declares the IExtractImage Interface for Python.
// Generated by makegw.py
// ---------------------------------------------------
//
// Interface Declaration
class PyIExtractImage : public PyIUnknown
{
public:
MAKE_PYCOM_CTOR(PyIExtractImage);
static IExtractImage *GetI(PyObject *self);
static PyComTypeObject type;
// The Python methods
static PyObject *GetLocation(PyObject *self, PyObject *args);
static PyObject *Extract(PyObject *self, PyObject *args);
protected:
PyIExtractImage(IUnknown *pdisp);
~PyIExtractImage();
};
Index: shell.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -C2 -d -r1.51 -r1.52
*** shell.cpp 15 Feb 2007 13:11:02 -0000 1.51
--- shell.cpp 25 Apr 2007 03:24:40 -0000 1.52
***************
*** 43,46 ****
--- 43,47 ----
#include "PyIUniformResourceLocator.h"
#include "PyIActiveDesktop.h"
+ #include "PyIExtractImage.h"
#include "PythonCOMRegister.h" // For simpler registration of IIDs etc.
***************
*** 2307,2310 ****
--- 2308,2312 ----
PYCOM_INTERFACE_FULL(ContextMenu),
PYCOM_INTERFACE_FULL(ExtractIcon),
+ PYCOM_INTERFACE_CLIENT_ONLY (ExtractImage),
PYCOM_INTERFACE_IID_ONLY (ExtractIconW),
PYCOM_INTERFACE_FULL(ShellExtInit),
|