I’m creating a wxpython app that needs to respond to a custom event created with the windows RegisterWindowMessage call.
but for some reason the wxPython side of things doesn’t seem to be processing the event. The custom event works fine when called within
the application with wx.PostMessage, but not when the event is sent from a different process. Using spy++ I can see that the message is being sent to the native window, anybody have any ideas?
Thanks in advance!
Here’s some code to give context.
wxPythonSide:
EVT_CUSTOM_ID = win32gui.RegisterWindowMessage( “mysillycustomevent” )
EVT_CUSTOM = wx.PyEventBinder( EVT_CUSTOM_ID )
class MyCustomEvent(wx.PyEvent):
def init(self, **kw):
wx.PyEvent.init(self)
self.SetEventType( EVT_CUSTOM_ID )
self.dict.update(kw)
then in the wxFrame class I:
self.Bind( EVT_CUSTOM, self.OnCustomEvent )
Other apps be it python or C call things this way:
EVT_CUSTOM_ID = win32gui.RegisterWindowMessage( “mysillycustomevent” )
def Callback( hwnd, param ):
text = win32gui.GetWindowText( hwnd )
if len(text) > 0 and text.startswith( param ):
win32gui.SendMessage( hwnd, EVT_CUSTOM_ID, 0, 0 )
def test_enum():
win32gui.EnumWindows( Callback, “SearchForWindow” )