[python-win32] HookMessage fails

TK Soh teekaysoh at gmail.com
Tue May 15 19:27:08 CEST 2007


On 5/15/07, Tim Roberts <timr at probo.com> wrote:
> TK Soh wrote:
> > The hooks are working, so I guess PYWIN_WITH_WINDOWPROC support has
> > indeed been compiled into ActivePython. The only problem now is the
> > strange behavior when sometime the hooks don't get triggered. Any
> > suggestion on workaround?
> >
>
> Where do you call HookWindow?  Are you calling it every time you create
> a new dialog window?
>
> Do you have access to the Platform SDK?  It might be worth using spyxx
> to monitor the message traffic to your dialogs, and see if anything
> changes from one invocation to the next.

Thanks for the info, but I'm not sure about Platform SDK. I started
doing this windows thing directly with python32.

The HookMessage is called in OnInitDialog(), so I presumed is called
every time a new dialog is created (I'm very new to windows
programming):

    def OnInitDialog(self):
        rc = Dialog.OnInitDialog(self)
        oldhanler = self.HookMessage(self.OnSize, win32con.WM_SIZE)

I just noticed yet another strange thing: the dialogs opened from the
'first' explorer window will always stay on top with respect to their
parent explorer window, while other dialogs maybe freely reordered.

Windowx (XP) also does not create taskbar menus (not sure this is what
they are called) for the custom dialogs that are opened from the
'first' explorer window.


More information about the Python-win32 mailing list