Thread: [pywin32-checkins] pywin32/Pythonwin win32win.cpp, 1.15, 1.16 win32win.h, 1.2, 1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2007-06-04 02:57:11
|
Update of /cvsroot/pywin32/pywin32/Pythonwin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21423 Modified Files: win32win.cpp win32win.h Log Message: Repair error I introduced to PyCWnd::SendMessage() and fix a number of other misc x64 issues in pywin Index: win32win.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** win32win.h 3 Jun 2007 12:35:58 -0000 1.2 --- win32win.h 4 Jun 2007 02:57:10 -0000 1.3 *************** *** 116,121 **** RETURN_TYPE_ERR("The object is not a Python MFC object"); } ! long wparam, lparam; ! if (!PyArg_ParseTuple(args, "ll", &wparam, &lparam)) return NULL; GUI_BGN_SAVE; --- 116,127 ---- RETURN_TYPE_ERR("The object is not a Python MFC object"); } ! PyObject *obwparam, *oblparam; ! if (!PyArg_ParseTuple(args, "OO", &obwparam, &oblparam)) ! return NULL; ! WPARAM wparam; ! LPARAM lparam; ! if (!PyWinObject_AsPARAM(obwparam, &wparam)) ! return NULL; ! if (!PyWinObject_AsPARAM(oblparam, &lparam)) return NULL; GUI_BGN_SAVE; Index: win32win.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/Pythonwin/win32win.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** win32win.cpp 3 Jun 2007 13:23:45 -0000 1.15 --- win32win.cpp 4 Jun 2007 02:57:10 -0000 1.16 *************** *** 784,795 **** if (!pWnd) return NULL; ! int message, wparam, lparam; ! if (!PyArg_ParseTuple(args,"iii:DefWindowProc", &message, // @pyparm int|message||The Windows message. ! &wparam, // @pyparm int|idLast||The lParam for the message. ! &lparam))// @pyparm int|idCheck||The wParam for the message. return NULL; GUI_BGN_SAVE; ! LRESULT rc = ((WndHack *)pWnd)->DefWindowProc(message, (WPARAM)wparam, (LPARAM)lparam); GUI_END_SAVE; return PyWinObject_FromPARAM(rc); // @pyseemfc CWnd|DefWindowProc --- 784,801 ---- if (!pWnd) return NULL; ! int message; ! PyObject *obwparam, *oblparam; ! if (!PyArg_ParseTuple(args,"iOO:DefWindowProc", &message, // @pyparm int|message||The Windows message. ! &obwparam, // @pyparm int|idLast||The lParam for the message. ! &oblparam))// @pyparm int|idCheck||The wParam for the message. ! return NULL; ! WPARAM wparam; ! LPARAM lparam; ! if (!PyWinObject_AsPARAM(obwparam, &wparam) || ! !PyWinObject_AsPARAM(oblparam, &lparam)) return NULL; GUI_BGN_SAVE; ! LRESULT rc = ((WndHack *)pWnd)->DefWindowProc(message, wparam, lparam); GUI_END_SAVE; return PyWinObject_FromPARAM(rc); // @pyseemfc CWnd|DefWindowProc *************** *** 1886,1895 **** return NULL; UINT message; WPARAM wParam=0; LPARAM lParam=0; ! if (!PyArg_ParseTuple(args, "i|ii:PostMessage", ! &message, // @pyparm int|idMessage||The ID of the message to post. ! &wParam, // @pyparm int|wParam|0|The wParam for the message ! &lParam)) // @pyparm int|lParam|0|The lParam for the message return NULL; // @pyseemfc CWnd|PostMessage --- 1892,1906 ---- return NULL; UINT message; + PyObject *obwParam = Py_None, *oblParam = Py_None; + if (!PyArg_ParseTuple(args, "i|OO:PostMessage", + &message, // @pyparm int|idMessage||The ID of the message to post. + &obwParam, // @pyparm int|wParam|0|The wParam for the message + &oblParam)) // @pyparm int|lParam|0|The lParam for the message + return NULL; WPARAM wParam=0; LPARAM lParam=0; ! if (obwParam != Py_None && !PyWinObject_AsPARAM(obwParam, &wParam)) ! return NULL; ! if (oblParam != Py_None && !PyWinObject_AsPARAM(oblParam, &lParam)) return NULL; // @pyseemfc CWnd|PostMessage *************** *** 2186,2200 **** return NULL; int message; ! int wParam=0; ! int lParam=0; ! WPARAM wp; ! LPARAM lp; ! if (PyArg_ParseTuple(args, "i|ii:SendMessage", &message, // @pyparm int|idMessage||The ID of the message to send. ! &wParam, // @pyparm int|wParam|0|The wParam for the message ! &lParam)) {// @pyparm int|lParam|0|The lParam for the message ! wp = (WPARAM)wParam; ! lp = (LPARAM)lParam; ! } else { // Allow a buffer object to be passed as (size, address) PyErr_Clear(); --- 2197,2212 ---- return NULL; int message; ! WPARAM wp = 0; ! LPARAM lp = 0; ! PyObject *obwParam = Py_None, *oblParam = Py_None; ! BOOL ok = FALSE; ! if (PyArg_ParseTuple(args, "i|OO:SendMessage", &message, // @pyparm int|idMessage||The ID of the message to send. ! &obwParam, // @pyparm int|wParam|0|The wParam for the message ! &oblParam)) {// @pyparm int|lParam|0|The lParam for the message ! ok = (obwParam == Py_None || PyWinObject_AsPARAM(obwParam, &wp)) && ! (oblParam == Py_None || PyWinObject_AsPARAM(oblParam, &lp)); ! } ! if (!ok) { // Allow a buffer object to be passed as (size, address) PyErr_Clear(); *************** *** 2205,2208 **** --- 2217,2221 ---- &obParam)) // @pyparmalt1 buffer|ob||A buffer whose size is passed in wParam, and address is passed in lParam return NULL; + int wParam; if (!PyWinObject_AsReadBuffer(obParam, &p, &wParam)) return NULL; *************** *** 2225,2237 **** return NULL; UINT message; - WPARAM wParam=0; - LPARAM lParam=0; BOOL bDeep = TRUE; ! if (!PyArg_ParseTuple(args, "i|iii:SendMessageToDescendants", &message, // @pyparm int|idMessage||The ID of the message to send. ! &wParam, // @pyparm int|wParam|0|The wParam for the message ! &lParam, // @pyparm int|lParam|0|The lParam for the message &bDeep)) // @pyparm int|bDeep|1|Indicates if the message should be recursively sent to all children return NULL; GUI_BGN_SAVE; // @pyseemfc CWnd|SendMessageToDescendants --- 2238,2255 ---- return NULL; UINT message; BOOL bDeep = TRUE; ! PyObject *obwParam = Py_None, *oblParam = Py_None; ! if (!PyArg_ParseTuple(args, "i|OOi:SendMessageToDescendants", &message, // @pyparm int|idMessage||The ID of the message to send. ! &obwParam, // @pyparm int|wParam|0|The wParam for the message ! &oblParam, // @pyparm int|lParam|0|The lParam for the message &bDeep)) // @pyparm int|bDeep|1|Indicates if the message should be recursively sent to all children return NULL; + WPARAM wParam=0; + LPARAM lParam=0; + if (obwParam != Py_None && !PyWinObject_AsPARAM(obwParam, &wParam)) + return NULL; + if (oblParam != Py_None && !PyWinObject_AsPARAM(oblParam, &lParam)) + return NULL; GUI_BGN_SAVE; // @pyseemfc CWnd|SendMessageToDescendants *************** *** 2619,2625 **** PAINTSTRUCT ps; PyObject *obString; // @pyparm <o PAINTSTRUCT>|paintStruct||The object returned from <om PyCWnd.BeginPaint> ! if (!PyArg_ParseTuple(args, "(ii(iiii)iiO)", ! &ps.hdc, &ps.fErase, &ps.rcPaint.left, &ps.rcPaint.top, &ps.rcPaint.right, &ps.rcPaint.bottom, --- 2637,2644 ---- PAINTSTRUCT ps; PyObject *obString; + PyObject *obhdc; // @pyparm <o PAINTSTRUCT>|paintStruct||The object returned from <om PyCWnd.BeginPaint> ! if (!PyArg_ParseTuple(args, "(Oi(iiii)iiO)", ! &obhdc, &ps.fErase, &ps.rcPaint.left, &ps.rcPaint.top, &ps.rcPaint.right, &ps.rcPaint.bottom, *************** *** 2633,2636 **** --- 2652,2658 ---- memcpy(ps.rgbReserved, PyString_AsString(obString), sizeof(ps.rgbReserved)); + if (!PyWinObject_AsHANDLE(obhdc, (HANDLE *)&ps.hdc)) + return NULL; + CWnd *pWnd = GetWndPtr (self); if (pWnd == NULL) |