Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!ucla-cs!ucivax!megatek!orion!hollen From: hollen@megatek.UUCP (Dion Hollenbeck) Newsgroups: comp.os.msdos.programmer Subject: Re: 4dos: intercepting command lines Message-ID: Date: 3 Jun 91 19:56:44 GMT References: <1991May31.103200.936@csc.canterbury.ac.nz> <91151.122254TOMIII@MTUS5.BITNET> Sender: hollen@megatek.UUCP Distribution: usa Organization: Megatek Corporation, San Diego, California Lines: 52 In-reply-to: TOMIII@MTUS5.BITNET's message of 31 May 91 17:22:54 GMT In article <91151.122254TOMIII@MTUS5.BITNET> TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes: > > While we're on the topic of command lines, how does one change the command > line *before* the ENTER key is pressed (ie - highlight text on the screen > with the mouse and click a button to place the text at the cursor in the > command line) ? > One way which comes to mind is to be the command interpreter and be constantly getting characters from the keyboard buffer. In this manner, you can do anything you want to them. This is why 4DOS can implement command-line editing, it is in control of getting the characters one by one and then echoing them in the proper manner depending on position in the buffer, and insert/overstrike mode. Short of being the command interpreter, you could intercept the keyboard BIOS interrupt vector, but the problem there is that you could never have enough smarts to know whether you were processing keystrokes at the command line, or in an application. There is another way possible to get keys from the mouse as you suggest. It however relies on the mouse operating "like a keyboard". The smarts would need to reside in the mouse software to be able to snatch the characters from the screen. When you made the appropriate button press to "stuff" the captured chars, then the mouse software would put the characters, one at a time, in the keyboard buffer. This is how my Logitech Mouse works now (with stuffing chars, it cannot cut from the screen, it is not smart enough). If I have the motion output set to generate arrow keys, then moving the mouse inserts appropriate arrow keys in the keyboard buffer as if I had typed them from the keyboard. Should be no problem with cut and paste text either, as long as the mouse driver is smart enough to know how to cut and paste. If there is not an existing mouse driver which does this, it would be not an excessively hard task to write one. > On the AT machines, there is an "Insert character in keyboard buffer" call, > but if the buffer fills you lose the end of the command. If you are using this and it solves your problem successfully, then the solution to missed keystrokes is a TSR which expands the size of the keyboard buffer. I use a 128 char buffer and I have never overflowed the buffer. If you need more, make sure to get a keybord enhancer which supports buffer size, and make it as big as necessary. Of course, keep in mind the DOS command line length limitation. If you go over that, even if it was in the buffer, DOS will not process more than 128 chars anyway. -- ----- Dion Hollenbeck (619) 455-5590 x2814 Megatek Corporation, 9645 Scranton Road, San Diego, CA 92121 uunet!megatek!hollen or hollen@megatek.uucp