// @pymethod |PyIDocHostUIHandler|TranslateAccelerator|Description of TranslateAccelerator. PyObject *PyIDocHostUIHandler::TranslateAccelerator(PyObject *self, PyObject *args) { IDocHostUIHandler *pIDHUIH = GetI(self); if ( pIDHUIH == NULL ) return NULL; MSG msg; PyObject *oblpMsg; // @pyparm <o PyLPMSG>|lpMsg||Description for lpMsg // @pyparm <o PyIID>|pguidCmdGroup||Description for pguidCmdGroup // @pyparm int|nCmdID||Description for nCmdID PyObject *obpguidCmdGroup; IID guidCmdGroup; DWORD nCmdID; if ( !PyArg_ParseTuple(args, "OOl:TranslateAccelerator", &oblpMsg, &obpguidCmdGroup, &nCmdID) ) return NULL; BOOL bPythonIsHappy = TRUE; if (bPythonIsHappy && !PyWinObject_AsMSG(oblpMsg, &msg)) bPythonIsHappy = FALSE; if (!PyWinObject_AsIID(obpguidCmdGroup, &guidCmdGroup)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIDHUIH->TranslateAccelerator(&msg, &guidCmdGroup, nCmdID ); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return PyCom_BuildPyException(hr, pIDHUIH, IID_IDocHostUIHandler ); return PyInt_FromLong(hr); }
BOOL CVirtualHelper::retval( MSG *msg ) { ASSERT(retVal); if (!retVal) return FALSE; // failed - assume didnt work in non debug CEnterLeavePython _celp; if (!PyWinObject_AsMSG(retVal, msg)){ gui_print_error(); return FALSE; } return TRUE; }
// @pymethod |PyIOleObject|DoVerb|Description of DoVerb. PyObject *PyIOleObject::DoVerb(PyObject *self, PyObject *args) { IOleObject *pIOO = GetI(self); if ( pIOO == NULL ) return NULL; // @pyparm int|iVerb||Description for iVerb // @pyparm <o PyMSG>|msg||MSG tuple, a-la win32gui etc. // @pyparm <o PyIOleClientSite>|pActiveSite||Description for pActiveSite // @pyparm int|lindex||Description for lindex // @pyparm HWND|hwndParent||Description for hwndParent // @pyparm (int, int, int, int)|rect|| PyObject *obpActiveSite; LONG iVerb; IOleClientSite * pActiveSite; LONG lindex; HWND hwndParent; MSG msg, *lpmsg = NULL; PyObject *obMsg; RECT rect; LPCRECT lprcPosRect = ▭ if ( !PyArg_ParseTuple(args, "iOOii(iiii):DoVerb", &iVerb, &obMsg, &obpActiveSite, &lindex, &hwndParent, &rect.left, &rect.top, &rect.right, &rect.bottom) ) return NULL; if (obMsg != Py_None) { lpmsg = &msg; if (!PyWinObject_AsMSG(obMsg, &msg)) return NULL; } BOOL bPythonIsHappy = TRUE; if (!PyCom_InterfaceFromPyInstanceOrObject(obpActiveSite, IID_IOleClientSite, (void **)&pActiveSite, TRUE /* bNoneOK */)) bPythonIsHappy = FALSE; if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; hr = pIOO->DoVerb( iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect ); if (pActiveSite) pActiveSite->Release(); PY_INTERFACE_POSTCALL; if ( FAILED(hr) ) return OleSetOleError(hr); Py_INCREF(Py_None); return Py_None; }