markz@microsoft.UUCP (Mark Zbikowski) (06/27/84)
"...If you wanted to write a ctrl-PrtScrn function to dump to a file, how can you do file I/O and return to the process? From what I hear, when you (try to) return, you end up hanging the system, etc. unless you do something? There are two questions lurking in here. First, how can I redirect ctrl-PrtScrn (^P) output to a file? Remember that ctrl-PrtScrn turn on printer echoing for the DOS as a whole. The following solution gives slightly less (or more) functionality. You need to write a program that will close handle 4 (standard printer) and open whatever file you'd like. Next, the program will EXEC (system call 4B) COMMAND. Now, whenever you issue ctrl-PrtScreen to the DOS, the printer output will appear in the file. Note, however, that the directory entry for the output file will not be correctly updated until the original program terminates. You'd need to type EXIT to the COMMAND in order to return to your original program. The second question is: "How can I do a SHIFT-PrtScrn to dump the contents of the screen to a file?" Unfortunately, SHIFT-PrtScrn can be entered at any time; this requires that you be able to issue system calls at any arbitrary time. Unfortunately again, DOS is not reentrant. Sigh.