Command prompts on a Windows station

Tim Roberts timr at probo.com
Wed Feb 14 01:56:30 EST 2001


Pieter Claerhout <Pieter_Claerhout at CreoScitex.com> wrote:
>
>is there a way in Python to catch that a command prompt was closed by
>clicking on the close button in the title bar?

Not as far as I know.  Clicking the 'close' button is a drastic
termination; it is a signal to the application that displays DOS windows
(WINOLDAP), which closes the VM without any further notice to the programs
running in the VM.  That's why, ordinarily, you get a "warning, is this
really what you want to do?" dialog when you close it that way.

If you were a clever sort, you might be able to do some magic with the
Win32 API.  You could use FindWindow to locate the window, subclass the
window with your own WndProc, and watch for WM_CLOSE messages.  However,
that's not very Python-like.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list