ScreenWatch Version 1 Created by Ray Lambert in 1990 Overview. ScreenWatch is a utility which sits in the background waiting for screens to close. When a screen is closed, it checks the screen to determine if it has any windows on it that are still open. If all is normal you will not even know that ScreenWatch is there. However, if it detects that someone is trying to close a screen with an open window on it, ScreenWatch will bring that screen to the front and open a requester on it informing you of the infraction, and allowing you the opportunity to close the window before the screen gets closed. All of this happens in a manner that is completely transparent to the program which is attempting to close its screen (that program is temporarily frozen until the situation is resolved). The main intended use for ScreenWatch is to protect users of "CLIanywhere", a program which allows CLIs and other programs to open their windows on any screen, from accidently closing a screen with an uninvited window still open on it. (Please see the documentation for CLIanywhere for more information about this). Although, ScreenWatch will also catch programs which do this on their own. It is very rare that a program will be caught doing this on its own however, because to do so is considered (almost) a mortal sin in the Amiga programming world. Usage. ScreenWatch is extremely easy to use. Simply run it by typing its name "ScreenWatch" at the CLI prompt, or in your Startup-Sequence file. ScreenWatch always automatically detachs itself completely from the CLI that it is run from, allowing that CLI to be closed later if you wish. To remove ScreenWatch, simply run it a second time. It will automatically detect that it has already been run, and will remove itself from memory. When it is removed, a message requester will appear on the Workbench screen informing you that it is gone. The only other time that you will hear from ScreenWatch is when it detects a screen closing that still has an open window on it. When this happens the offending screen will be brought to the front and a requester will appear on it which says: "A window is open on this screen!". The requester has two buttons in it which are labeled: "I've Closed It" and "Ignore It". Clicking on the first instructs ScreenWatch that you've closed the window. ScreenWatch will then re-check the screen -- if you really haven't closed the window or if there is yet another window still open on the screen the same requester will return immediately. Clicking on "Ignore It" instructs ScreenWatch that you don't care about the situation or the consequences of allowing the screen to be closed while it still contains an open window. ScreenWatch will then allow the screen to be closed even though the window is still open. This second option is really only intended for a situation when you cannot close the window for some reason. If for some reason ScreenWatch cannot open its requester on the offending screen, it will open an alert instead. This is actually an automatic function of Intuition, invoked when it cannot open a requester. Intuition will render the alert so it appears like the requester would have, using the same messages as described above. However, instead of clicking on buttons to make your decision of what to do with the window, an alert would have you pressing either the left or right mouse button to select one option or the other. Unfortunately, an alert does not give you the opportunity to close the window. Therefore, only the "Ignore It" option is of any use here, and there is no choice except to allow the screen to be closed with the window still open. This situation is extremely rare -- it should only happen in extremely low-memory situations or situations where the system is already munged pretty badly -- so it is nothing to worry about; you will most likely never encounter it. Legal stuff. ScreenWatch is public domain. I have included the source code so that other programmers can see how it works. ScreenWatch is part of the CLIanywhere package and I would very much like the whole package to be kept together as one if it is distributed anywhere. Get to know me! If you have any questions, suggestions, flames, propositions, etc., I can be reached at the following places: People/Link: Analog*Kid (log on often) BIX: AnalogKid (log on sparsely) U.S. Snail: Ray Lambert PO Box 1253 Westport, Massachusetts 02790 Phone: (508) 677-9217