[python-win32] python win32 demos question

Mark Hammond mhammond at skippinet.com.au
Wed Jan 19 03:45:47 CET 2005


> In the win32\demos directory, there is a script called
> win32gui_dialog.py. Near the end of this script, there are
> the following
> lines:

That script obviously had a quick bash at it and it failed :)  I have fixed
the demo and will attach it in private mail.  The upshot is:

win32gui.PumpMessages() will run until the thread gets a WM_QUIT message,
via someone calling PostQuitMessage().  The demo had this in the WM_DESTROY
handler for the dialog itself which was wrong for 2 reasons:
* This is not needed when the dialog is a "normal" dialog.
* When used as a Window, WM_DESTROY is not automatically sent - someone
needs to call DestroyWindow (rather than the EndDialog needed for the
"normal" dialog).  The fix for this is to have WM_CLOSE call
DestroyWindow(), which then triggers the WM_DESTROY, which then calls
PostQuitMessage (whew).

Mark



More information about the Python-win32 mailing list