Hi, Tim,

Your idea probably works as well, but I found another way to catch user
defined message. Thanks a lot!

For the handler of the second app, win32gui.FindWindow can do this job,
then win32gui.PostMessage.  But for FindWindow, I can only find the
specific window by its title, not by its registered class, which I
posted another message.
Any idea? 

James

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Roberts
Sent: Friday, October 21, 2005 12:57 PM
To: python-win32@python.org
Subject: [python-win32] create user message for wxPython

On Thu, 20 Oct 2005 16:26:35 -0400, "James Hu" <[EMAIL PROTECTED]>

>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, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to