home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / alt / msdos / programm / 2279 < prev    next >
Encoding:
Text File  |  1992-08-27  |  3.7 KB  |  99 lines

  1. Newsgroups: alt.msdos.programmer
  2. Path: sparky!uunet!stanford.edu!rock!taco!dspascha
  3. From: dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL)
  4. Subject: Re: Keyboard Interrupt
  5. Message-ID: <1992Aug27.210232.5967@ncsu.edu>
  6. Originator: dspascha@c00085-100lez.eos.ncsu.edu
  7. Lines: 85
  8. Sender: news@ncsu.edu (USENET News System)
  9. Reply-To: dspascha@eos.ncsu.edu (DAVID SCOTT PASCHAL)
  10. Organization: North Carolina State University, Project Eos
  11. References:  <g89f2900.4.714907231@giraffe.ru.ac.za>
  12. Date: Thu, 27 Aug 1992 21:02:32 GMT
  13.  
  14.  
  15. In article <g89f2900.4.714907231@giraffe.ru.ac.za>, g89f2900@giraffe.ru.ac.za (MR BRI FAWTHROP) writes:
  16. |> Path: taco!rock!stanford.edu!ames!haven.umd.edu!uunet!zephyr.ens.tek.com!psgrain!hippo!bs-pc3-06.ru.ac.za!g89f2900
  17. |> From: g89f2900@giraffe.ru.ac.za (MR BRI FAWTHROP)
  18. |> Newsgroups: alt.msdos.programmer
  19. |> Subject: Keyboard Interrupt
  20. |> Message-ID: <g89f2900.4.714907231@giraffe.ru.ac.za>
  21. |> Date: Thu, 27 Aug 92 05:20:31 GMT+5:00
  22. |> Sender: news@hippo.ru.ac.za
  23. |> Organization: Rhodes University, Grahamstown, South Africa
  24. |> Lines: 34
  25. |> 
  26. |> Hi
  27. |> 
  28. |> I am trying to write  program  which reads the keyboard buffer, before the 
  29. |> command.com interrupter does.
  30. |> In other words
  31. |> I want to write a program that if certain keywords are typed in it will go 
  32. |> and do some function.
  33. |> otherwise it must act as normal.
  34. |> 
  35. |> eg
  36. |>  enter CLS
  37. |>    I want it to first do the normal clearscreen 
  38. |>    but afterwards it must print my name and time and other tings on the top 
  39. |>    of the screen.
  40. |>         ( I will write the program that prints my name and other things )
  41. |>         ( But I need to know how to link in the keyboard interrupt   so )
  42. |>         ( that when it reads CLS if first does CLS and then comes and   )
  43. |>         ( executes my program. )
  44. |> 
  45. |>  OR
  46. |>  enter TIME
  47. |>    I want it to ask me if I want to change the time or just display it.
  48. |>    THEN it must go and do the NORMAL time function.
  49. |>           ( same applies here I will write the program but how do I )
  50. |>           ( link it into the keyboard interrupt )
  51. |> 
  52. |> Does anyone know if this is possible ???
  53. |> 
  54. |> PLEASE I HAVE BEEN TRYING FOR +/- 4 mths. BUT no-one I have asked knows
  55. |> what to do or even how to HELP
  56. |> 
  57. |> Barry Fawthrop.
  58. |> g89f2900@giraffe.ru.ac.za
  59. |>   
  60. |> 
  61.  
  62. Hi.  This seems rather difficult to do with a keyboard intercept, partly because
  63. it would be difficult to determine whether or not you're sitting at a
  64. COMMAND.COM C:\> prompt or in an application program.  What I would suggest is
  65. this: take a disk editor and "hack" up COMMAND.COM -- find where in the file it
  66. stores its command table, and replace maybe the first letter of each command
  67. you want to change with an underscore (or whatever character you want to use --
  68. just be sure it's some character allowed in a filename).  So let's say you've
  69. changed "TIME" and "CLS" to "_IME" and "_LS".  Now create some batch files
  70. called "TIME.BAT" and "CLS.BAT" that say something like the following:
  71.  
  72. CLS.BAT:
  73. _ls
  74. echo Hi.  This is my computer.  Hope you enjoy it.
  75.  
  76. TIME.BAT:
  77. echo Hi.  Do you want to change the time? (Y/N)
  78. yesno
  79. if errorlevel 1 goto settime
  80. _ime<newline.txt
  81. goto end
  82. :settime
  83. time
  84. :end
  85.  
  86. In addition, you'll need to create a file with a single blank line called
  87. "newline.txt" (or whatever you want to call it) that when fed into the standard
  88. input of the _IME command will do the same thing as pressing <Enter> at the
  89. "Enter new time" prompt.  You'll also need to find or write a short program
  90. that waits for a Y or N to be pressed on the keyboard and returns exit code 1
  91. if Y or y pressed, otherwise exit code 0.  But this shouldn't be too hard to
  92. write.  (I suppose a lot easier than writing a keyboard interrupt handler to
  93. do all this!)  :-)
  94.  
  95. Hope this helps.
  96.  
  97. Tschuess,
  98. David Paschal
  99.