[pywin32-checkins] pywin32/win32/src PyWinTypes.h, 1.48, 1.49 PyWinTypesmodule.cpp, 1.33, 1.34 win3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2007-10-12 00:35:18
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7340 Modified Files: PyWinTypes.h PyWinTypesmodule.cpp win32gui.i Log Message: Add utility functions for handling MSG structures. Index: PyWinTypesmodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** PyWinTypesmodule.cpp 12 Aug 2007 08:10:28 -0000 1.33 --- PyWinTypesmodule.cpp 12 Oct 2007 00:35:09 -0000 1.34 *************** *** 743,746 **** --- 743,775 ---- } + BOOL PyWinObject_AsMSG(PyObject *ob, MSG *pMsg) + { + PyObject *obhwnd; + if (!PyArg_ParseTuple(ob, "Oiiii(ii):MSG param", + &obhwnd, + &pMsg->message, + &pMsg->wParam, + &pMsg->lParam, + &pMsg->time, + &pMsg->pt.x, + &pMsg->pt.y)) + return FALSE; + if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&pMsg->hwnd)) + return FALSE; + return TRUE; + } + + PyObject *PyWinObject_FromMSG(MSG *pMsg) + { + return Py_BuildValue("Niiii(ii)", + PyWinLong_FromHANDLE(pMsg->hwnd), + pMsg->message, + pMsg->wParam, + pMsg->lParam, + pMsg->time, + pMsg->pt.x, + pMsg->pt.y); + } + /* List of functions exported by this module */ Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** PyWinTypes.h 12 Aug 2007 08:10:28 -0000 1.48 --- PyWinTypes.h 12 Oct 2007 00:35:09 -0000 1.49 *************** *** 534,537 **** --- 534,541 ---- PYWINTYPES_EXPORT BOOL PyWinObject_CloseHKEY(PyObject *obHandle); + // MSG structure keeps coming up... + PYWINTYPES_EXPORT BOOL PyWinObject_AsMSG(PyObject *ob, MSG *pMsg); + PYWINTYPES_EXPORT PyObject *PyWinObject_FromMSG(const MSG *pMsg); + #include "winsock.h" /* Index: win32gui.i =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32gui.i,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** win32gui.i 3 Sep 2007 05:01:59 -0000 1.111 --- win32gui.i 12 Oct 2007 00:35:09 -0000 1.112 *************** *** 347,359 **** %typemap(python,argout) MSG *OUTPUT{ ! PyObject *o; ! o = Py_BuildValue("Niiii(ii)", ! PyWinLong_FromHANDLE($source->hwnd), ! $source->message, ! $source->wParam, ! $source->lParam, ! $source->time, ! $source->pt.x, ! $source->pt.y); if (!$target) { $target = o; --- 347,351 ---- %typemap(python,argout) MSG *OUTPUT{ ! PyObject *o = PyWinObject_FromMSG($source); if (!$target) { $target = o; *************** *** 374,390 **** %typemap(python,in) MSG *INPUT { - PyObject *obhwnd; $target = (MSG *)_alloca(sizeof(MSG)); ! if (!PyArg_ParseTuple($source, "Oiiii(ii):MSG param for $name", ! &obhwnd, ! &$target->message, ! &$target->wParam, ! &$target->lParam, ! &$target->time, ! &$target->pt.x, ! &$target->pt.y)) return NULL; - if (!PyWinObject_AsHANDLE(obhwnd, (HANDLE *)&$target->hwnd)) - return NULL; } %typemap(python,ignore) RECT *OUTPUT(RECT rect_output) --- 366,372 ---- %typemap(python,in) MSG *INPUT { $target = (MSG *)_alloca(sizeof(MSG)); ! if (!PyWinObject_AsMSG($source, $target)) return NULL; } %typemap(python,ignore) RECT *OUTPUT(RECT rect_output) |