[pywin32-checkins] pywin32/com/win32comext/shell/src PyIContextMenu.cpp, 1.3, 1.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Roger U. <ru...@us...> - 2007-01-21 11:40:49
|
Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2508/com/win32comext/shell/src Modified Files: PyIContextMenu.cpp Log Message: Fix HMENU treated as int, autoduck improvements Index: PyIContextMenu.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIContextMenu.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PyIContextMenu.cpp 26 Jan 2005 22:31:09 -0000 1.3 --- PyIContextMenu.cpp 21 Jan 2007 11:40:40 -0000 1.4 *************** *** 25,29 **** } ! // @pymethod |PyIContextMenu|QueryContextMenu|Description of QueryContextMenu. PyObject *PyIContextMenu::QueryContextMenu(PyObject *self, PyObject *args) { --- 25,29 ---- } ! // @pymethod |PyIContextMenu|QueryContextMenu|Adds options to a context menu PyObject *PyIContextMenu::QueryContextMenu(PyObject *self, PyObject *args) { *************** *** 31,51 **** if ( pICM == NULL ) return NULL; ! // @pyparm int|hmenu||Description for hmenu ! // @pyparm int|indexMenu||Description for indexMenu ! // @pyparm int|idCmdFirst||Description for idCmdFirst ! // @pyparm int|idCmdLast||Description for idCmdLast ! // @pyparm int|uFlags||Description for uFlags ! INT hmenu; UINT indexMenu; UINT idCmdFirst; UINT idCmdLast; UINT uFlags; ! if ( !PyArg_ParseTuple(args, "iiiii:QueryContextMenu", &hmenu, &indexMenu, &idCmdFirst, &idCmdLast, &uFlags) ) return NULL; - BOOL bPythonIsHappy = TRUE; - if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; ! hr = pICM->QueryContextMenu( (HMENU)hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); PY_INTERFACE_POSTCALL; --- 31,52 ---- if ( pICM == NULL ) return NULL; ! HMENU hmenu; ! PyObject *obhmenu; UINT indexMenu; UINT idCmdFirst; UINT idCmdLast; UINT uFlags; ! if ( !PyArg_ParseTuple(args, "OIIII:QueryContextMenu", ! &obhmenu, // @pyparm <o PyHANDLE>|hmenu||Handle to menu to which items should be added ! &indexMenu, // @pyparm int|indexMenu||Zero-based index at which to add first item ! &idCmdFirst, // @pyparm int|idCmdFirst||Minimum menu item Id ! &idCmdLast, // @pyparm int|idCmdLast||Max menu item Id ! &uFlags)) // @pyparm int|uFlags||Combination of shellcon.CMF_* flags, can be 0 ! return NULL; ! if (!PyWinObject_AsHANDLE(obhmenu, (HANDLE *)&hmenu, FALSE)) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; ! hr = pICM->QueryContextMenu(hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags ); PY_INTERFACE_POSTCALL; *************** *** 56,60 **** } ! // @pymethod |PyIContextMenu|InvokeCommand|Description of InvokeCommand. PyObject *PyIContextMenu::InvokeCommand(PyObject *self, PyObject *args) { --- 57,61 ---- } ! // @pymethod |PyIContextMenu|InvokeCommand|Executes a context menu option PyObject *PyIContextMenu::InvokeCommand(PyObject *self, PyObject *args) { *************** *** 66,72 **** if ( !PyArg_ParseTuple(args, "O:InvokeCommand", &oblpici) ) return NULL; ! BOOL bPythonIsHappy = TRUE; ! if (bPythonIsHappy && !PyObject_AsCMINVOKECOMMANDINFO( oblpici, &ci )) bPythonIsHappy = FALSE; ! if (!bPythonIsHappy) return NULL; HRESULT hr; PY_INTERFACE_PRECALL; --- 67,74 ---- if ( !PyArg_ParseTuple(args, "O:InvokeCommand", &oblpici) ) return NULL; ! ! if (!PyObject_AsCMINVOKECOMMANDINFO( oblpici, ! &ci )) // @pyparm <o PyCMINVOKECOMMANDINFO>|pici||Tuple of parameters representing a CMINVOKECOMMANDINFO struct ! return NULL; HRESULT hr; PY_INTERFACE_PRECALL; *************** *** 82,86 **** } ! // @pymethod |PyIContextMenu|GetCommandString|Description of GetCommandString. PyObject *PyIContextMenu::GetCommandString(PyObject *self, PyObject *args) { --- 84,88 ---- } ! // @pymethod |PyIContextMenu|GetCommandString|Retrieves verb or help text for a context menu option PyObject *PyIContextMenu::GetCommandString(PyObject *self, PyObject *args) { *************** *** 88,98 **** if ( pICM == NULL ) return NULL; ! // @pyparm int|idCmd||Description for idCmd ! // @pyparm int|uType||Description for uType ! // @pyparm int|cchMax|2048|Description for cchMax UINT idCmd; UINT uType; UINT cchMax = 2048; ! if ( !PyArg_ParseTuple(args, "ii|i:GetCommandString", &idCmd, &uType, &cchMax) ) return NULL; --- 90,100 ---- if ( pICM == NULL ) return NULL; ! // @pyparm int|idCmd||Id of the command ! // @pyparm int|uType||One of the shellcon.GCS_* constants ! // @pyparm int|cchMax|2048|Size of buffer to create for returned string UINT idCmd; UINT uType; UINT cchMax = 2048; ! if ( !PyArg_ParseTuple(args, "II|I:GetCommandString", &idCmd, &uType, &cchMax) ) return NULL; *************** *** 118,124 **** static struct PyMethodDef PyIContextMenu_methods[] = { ! { "QueryContextMenu", PyIContextMenu::QueryContextMenu, 1 }, // @pymeth QueryContextMenu|Description of QueryContextMenu ! { "InvokeCommand", PyIContextMenu::InvokeCommand, 1 }, // @pymeth InvokeCommand|Description of InvokeCommand ! { "GetCommandString", PyIContextMenu::GetCommandString, 1 }, // @pymeth GetCommandString|Description of GetCommandString { NULL } }; --- 120,126 ---- static struct PyMethodDef PyIContextMenu_methods[] = { ! { "QueryContextMenu", PyIContextMenu::QueryContextMenu, 1 }, // @pymeth QueryContextMenu|Adds options to a context menu ! { "InvokeCommand", PyIContextMenu::InvokeCommand, 1 }, // @pymeth InvokeCommand|Executes a context menu option ! { "GetCommandString", PyIContextMenu::GetCommandString, 1 }, // @pymeth GetCommandString|Retrieves verb or help text for a context menu option { NULL } }; *************** *** 141,145 **** PY_GATEWAY_METHOD; PyObject *ret; ! HRESULT hr=InvokeViaPolicy("QueryContextMenu", &ret, "iiiii", hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags); if (FAILED(hr)) return hr; if (PyInt_Check(ret)) --- 143,147 ---- PY_GATEWAY_METHOD; PyObject *ret; ! HRESULT hr=InvokeViaPolicy("QueryContextMenu", &ret, "NIIII", PyWinLong_FromHANDLE(hmenu), indexMenu, idCmdFirst, idCmdLast, uFlags); if (FAILED(hr)) return hr; if (PyInt_Check(ret)) *************** *** 168,172 **** PyObject *result; PY_GATEWAY_METHOD; ! HRESULT hr=InvokeViaPolicy("GetCommandString", &result, "ii", idCmd, uFlags); if (FAILED(hr)) return hr; --- 170,174 ---- PyObject *result; PY_GATEWAY_METHOD; ! HRESULT hr=InvokeViaPolicy("GetCommandString", &result, "II", idCmd, uFlags); if (FAILED(hr)) return hr; |