[python-win32] win32api & win32gui help

Roger Upole rupole at hotmail.com
Sun Mar 2 21:33:59 CET 2014


Where does the hardcoded 99999 come from in this line ?

        win32api.PostMessage(hwnd,message,1,99999)

If I'm interpreting the docs correctly, that parm should be a handle
to a top-level window you create yourself that receives messages
from the app.

Also, you'll need to be running a message loop to receive messages
(see win32gui.PumpMessages).

    Roger

"Joe Bennett" <jammer10000 at ka3nam.com> wrote in message news:CAD+1-4-_COysP3H1GFgeF4dH3rgVr3u4aVk4zqhiYeNU5ABOkQ at mail.gmail.com...
> Hi,
>
> Looking for a good simple remedial course on getting my python script
> to talk to a Windows program. The author of the windows program has
> documented the api here:
>
> http://www.logger32.net/help/Logger32/Using%20the%20Logger32%20External%20Interface.htm
>
>
> I'm struggling to understand how to implement the messages with
> win32api/ gui... I've taken a stab at it here based on my searching
> the web with my first goal being that I just want to 'register' with
> the program and receive the response
> from it. So far I'm still scratching my head over this...
>
> I get a response for 'hwnd' but have not been able to get any
> confirmation that RegisterMessage, PostMessage and GetMessage are
> working, configured properly or...what...
>
> Running this all in WIN7 with ActivePython 2.6.6...
>
>
> import win32api
> import win32gui
>
> hwnd = win32gui.FindWindowEx(0, 0, 0, "Logger32")
>
>
> print "hwnd= ", hwnd
>
> message = win32api.RegisterWindowMessage("Logger32 3")
>
>
> win32api.PostMessage(hwnd,message,1,99999)
>
> test = win32gui.GetMessage(hwnd,0,0)
>
> print "GetMessage: ", test
>
>
>
> Thanks!!!!
>
>
> -Joe
> KA3NAM 





More information about the python-win32 mailing list