|
How to close another application from director
This info applies to Windows only.
Its quite easy using buddy Api xtra.
You will have to know the exact window title of the app you want to close.
The basic steps are:
determine what the windowHandle of that other window is.
send a message to the window with that handle to make it close.
See buddy api help on :
baWindowlist if you want to search through all existent windows
baFindwindow for an easier way to find the windowhandle of some window
baCloseWindow for a polite invitation to commit seppuku
baCloseApp for a rude (and more dangerous) way to kill a window.
There is an example available here (.zip, 14k.)
However, this one has been made with the aim of displaying some info.
If you run it you get a long list with every window that exists currently on
your system.
Doubbleclicking a line will politely ask that window to close.
Caveat:
It is quite easy to kill a window that was needed somehow. So playing around
with this movie while there is lots of unsaved work in some other open window
is a convenient way to accidently loose important data.
It may even be a good idea to reboot afterwards, dependant on the kind of
windows you shot by mistake. you have been warned.
Daniel Plänitz
9/2002
|