[python-win32] HookMessage fails

TK Soh teekaysoh at gmail.com
Tue May 15 19:49:51 CEST 2007


On 5/15/07, Tim Roberts <timr at probo.com> wrote:
> TK Soh wrote:
> >
> > 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):
>
> Yes, it is.  WM_INITDIALOG is called after all the child controls are
> created but before the dialog is made visible.  It was designed
> specifically for things like your subclassing.
>
>
> >    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.
>
> Interesting that they behave so differently.  That begins to suggest
> they have different parents.  What do you specify as the parent when you
> create the dialog?

Actually I didn't specify any parent at all:

class MyDialog(Dialog):
    def __init__(self, title=None, tmpl=None):
        self.title = title
        if tmpl is None:
            tmpl = dlg_template()
        Dialog.__init__(self, tmpl)

I don't see the parent being passed into the dialogs in pywin32's
sample code. Is this going to be a problem?


More information about the Python-win32 mailing list