home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / mswindo / programm / misc / 4497 < prev    next >
Encoding:
Text File  |  1992-12-29  |  2.1 KB  |  43 lines

  1. Newsgroups: comp.os.ms-windows.programmer.misc
  2. Path: sparky!uunet!munnari.oz.au!comp.vuw.ac.nz!actrix!Peter.Hug
  3. From: Peter.Hug@bbs.actrix.gen.nz
  4. Subject: Echoing lines of text to printer device
  5. Organization: Actrix Information Exchange
  6. Date: Tue, 29 Dec 1992 04:10:32 GMT
  7. Message-ID: <1992Dec29.041032.27808@actrix.gen.nz>
  8. Sender: Peter.Hug@actrix.gen.nz (Peter Hug)
  9. Lines: 32
  10.  
  11. One of the features of my alarm-monitoring MS-Windows app I am currently
  12. developing is to process messages from hardware devices connected to COMM
  13. ports and output them concurrently to a window and a printer (the printed
  14. output is a hardcopy of the sequence of events, called "Event-Log"). While
  15. dumping messages to a window is a breeze, the same cannot be said about the
  16. printer.
  17.  
  18. The only way I managed to rout an event immediately to the printer
  19. (complying with MS-Windows printing procedures) was by using StartDoc(),
  20. Escape(...PASSTHROUGH...) and EndDoc(). A single event is sent with
  21. PASSTHROUGH and formated with CR\LF control characters. The application
  22. knows how many lines fit on the printer and the last event that fits on
  23. a page is terminated with a FF control character.
  24.  
  25. While this approach works, it has some nasty side effects:
  26.  
  27. - If I use another application to print documents, this document does
  28.   not start on a new page (my app isn't aware of this and doesn't
  29.   send a FormFeed to the printer). Furthermore, my app does no longer
  30.   propper page advances since it has invalid information about the page
  31.   position.
  32.  
  33. - Also, numerous events can occur simultaneously. Since each event causes
  34.   a seperate document be sent to the printer, the print manager complains
  35.   as soon as more than 100 documents (events) are queued. If I buffer events
  36.   mayself (eg. if many events arive and I send as many events as possible
  37.   within a single document to the spooler), the log prints only once the
  38.   EndDoc() function is called. However, since the user can see all ariving
  39.   events appearing in the event window but nothing appears on the printer,
  40.   she/he gets the impression that something is wrong.
  41.  
  42. Does anyone know how this can be accomplished propperly? Or do I have to
  43.