[pywin32-checkins] pywin32/com/win32com/src/extensions PyIOleWindow.cpp,NONE,1.1
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-10-09 00:26:33
|
Update of /cvsroot/pywin32/pywin32/com/win32com/src/extensions In directory sc8-pr-cvs1:/tmp/cvs-serv32050/extensions Added Files: PyIOleWindow.cpp Log Message: PyIOleWindow gets upgraded to a core interface! --- NEW FILE: PyIOleWindow.cpp --- // This file implements the IOleWindow Interface and Gateway for Python. // Generated by makegw.py #include "stdafx.h" #include "PythonCOM.h" #include "PythonCOMServer.h" #include "PyIOleWindow.h" // @doc - This file contains autoduck documentation // --------------------------------------------------- // // Interface Implementation PyIOleWindow::PyIOleWindow(IUnknown *pdisp): PyIUnknown(pdisp) { ob_type = &type; } PyIOleWindow::~PyIOleWindow() { } /* static */ IOleWindow *PyIOleWindow::GetI(PyObject *self) { return (IOleWindow *)PyIUnknown::GetI(self); } // @pymethod |PyIOleWindow|GetWindow|Description of GetWindow. PyObject *PyIOleWindow::GetWindow(PyObject *self, PyObject *args) { IOleWindow *pIOW = GetI(self); if ( pIOW == NULL ) return NULL; HWND phwnd; if ( !PyArg_ParseTuple(args, ":GetWindow") ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIOW->GetWindow( &phwnd ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIOW, IID_IOleWindow); PyObject *pyretval = Py_BuildValue("i", phwnd); return pyretval; } // @pymethod |PyIOleWindow|ContextSensitiveHelp|Description of ContextSensitiveHelp. PyObject *PyIOleWindow::ContextSensitiveHelp(PyObject *self, PyObject *args) { IOleWindow *pIOW = GetI(self); if ( pIOW == NULL ) return NULL; // @pyparm int|fEnterMode||Description for fEnterMode BOOL fEnterMode; if ( !PyArg_ParseTuple(args, "i:ContextSensitiveHelp", &fEnterMode) ) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIOW->ContextSensitiveHelp( fEnterMode ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIOW, IID_IOleWindow); Py_INCREF(Py_None); return Py_None; } // @object PyIOleWindow|Description of the interface static struct PyMethodDef PyIOleWindow_methods[] = { { "GetWindow", PyIOleWindow::GetWindow, 1 }, // @pymeth GetWindow|Description of GetWindow { "ContextSensitiveHelp", PyIOleWindow::ContextSensitiveHelp, 1 }, // @pymeth ContextSensitiveHelp|Description of ContextSensitiveHelp { NULL } }; PyComTypeObject PyIOleWindow::type("PyIOleWindow", &PyIUnknown::type, sizeof(PyIOleWindow), PyIOleWindow_methods, GET_PYCOM_CTOR(PyIOleWindow)); // --------------------------------------------------- // // Gateway Implementation STDMETHODIMP PyGOleWindow::GetWindow( /* [out] */ HWND __RPC_FAR * phwnd) { PY_GATEWAY_METHOD; PyObject *result; HRESULT hr=InvokeViaPolicy("GetWindow", &result); if (FAILED(hr)) return hr; // Process the Python results, and convert back to the real params if (!PyArg_Parse(result, "i" , phwnd)) return PyCom_HandlePythonFailureToCOM(/*pexcepinfo*/); Py_DECREF(result); return hr; } STDMETHODIMP PyGOleWindow::ContextSensitiveHelp( /* [in] */ BOOL fEnterMode) { PY_GATEWAY_METHOD; HRESULT hr=InvokeViaPolicy("ContextSensitiveHelp", NULL, "i", fEnterMode); return hr; } |