[python-win32] create user message for wxPython
Tim Roberts
timr at probo.com
Fri Oct 21 18:56:34 CEST 2005
On Thu, 20 Oct 2005 16:26:35 -0400, "James Hu" <jhu at metrigenix.com>
>There are 2 wxPython application, A and B and need to exchange msg.
>Sending WM_CLOSE, wxEVT_MOUSEWHEEL to B is OK, and sending user message
>like 1225 from A to B is also OK.
>
>But B didn't catch this message, note, B is running before A sends msg
>and can receive "WM_CLOSE".
>
>Do I have to make my own msg loop by using win32api, win32gui? I used
>win32gui to post Message to other windows.
>
>Using wx.Frame:
>
>wx.EVT_START_MSG= 1225
>EVT_START_MSG_EVENT= wx.PyEventBinder(wx.EVT_START_MSG, 0)
>
>
>EVT_START_MSG_EVENT(self, self.OnStart)
>Or
>Self.Bind(EVT_START_MSG_EVENT,self.OnStart)
>
>def OnStart(self, event):
> print 'got start message'
>
>
Application B must have a message loop in order to receive messages.
You said application B was also a wxPython application. Doesn't it
already have a wxApp and a wxFrame main window? If you are running
app.MainLoop(), that should be enough to catch messages. As long as
that "OnStart" function is a member of the frame class, it should work.
How are you sending the messages? How did you get the window handle of
the second application?
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the Python-win32
mailing list