[python-win32] CLosing/Shutting down a COM application,
started from a Python program
Mark Hammond
mhammond at skippinet.com.au
Tue May 6 12:15:44 EDT 2003
> Is there a way to close the program via COM ?
It depends on the object. If you release the last reference to an
application, it may close. You release a reference by setting the object to
None, and can use pythoncom._GetInterfaceCount() to ensure there are no
references hiding.
However, some apps wont shutdown, most notably MS Office whenever the
"Visible" property is set to True. Office apps have a "Quit" method, and I
believe that resetting them to invisible then removing all references also
works. Certainly Word and Excel etc all shutdown correctly if you never set
Visible to True and delete all your references.
Mark.
More information about the Python-win32
mailing list