From 74b89e4f5ed317bfc869beb6593164afd7c0ef4f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 16 Sep 2024 06:25:39 +0800 Subject: [PATCH] add WatchWinMsg sample --- PyRxCore/PyApApplication.cpp | 1 - PySamples/PyAp/testWatchWinMsg.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 PySamples/PyAp/testWatchWinMsg.py diff --git a/PyRxCore/PyApApplication.cpp b/PyRxCore/PyApApplication.cpp index 33017768..2d906467 100644 --- a/PyRxCore/PyApApplication.cpp +++ b/PyRxCore/PyApApplication.cpp @@ -178,7 +178,6 @@ bool PyApApplication::registerWatchWinMsg(const boost::python::object& winmsg_pf bool PyApApplication::removeWatchWinMsg(const boost::python::object& winmsg_pfn) { - if (winmsgFuncs.contains(winmsg_pfn.ptr())) { winmsgFuncs.erase(winmsg_pfn.ptr()); diff --git a/PySamples/PyAp/testWatchWinMsg.py b/PySamples/PyAp/testWatchWinMsg.py new file mode 100644 index 00000000..994d9202 --- /dev/null +++ b/PySamples/PyAp/testWatchWinMsg.py @@ -0,0 +1,28 @@ +import traceback +from pyrx_imp import Rx, Ge, Gs, Gi, Db, Ap, Ed + +#WatchWinMsg +print("command = startWatch") +print("command = endWatch") + +WM_MOUSEMOVE = 512 + +#messageId, hwnd, lParam, wParam, pt.x, pt.y,time)); +def winMessage(msg): + if msg[0] == WM_MOUSEMOVE: + print(msg[4],msg[5]) + + +def PyRxCmd_startWatch(): + try: + Ap.Application.registerWatchWinMsg(winMessage) + except Exception as err: + print(err) + +def PyRxCmd_endWatch(): + try: + Ap.Application.removeWatchWinMsg(winMessage) + except Exception as err: + print(err) + +