Printing

Q. How do I send the data to the printing device?

This topic is wide; therefore, I recommend that you read another book [12], where it is covered in detail, if you are interested in this topic. As relates to this book, I'll provide the most general algorithm that Windows uses for printing. I hope that it will help you to quickly understand the printing basics.

  • Printing is similar to screen output. The same functions, such as TextOut or Ellipse , are used for this purpose. To accomplish screen output, it is necessary to know the printer context.

  • In contrast to screen output, a printer device must be created instead of obtained. To achieve this, use the createDC function, the second parameter of which is the pointer to the string containing the printer name . The remaining three parameters are usually set to NULL .

  • The PrintDLG function allows the user to choose the printer name in a dialog. This function returns the printer context.

  • If you decide to use the CreateDC function, you need to get the printer names available in the system. For this purpose, use the EnumPrinters function. It provides a powerful tool for detecting not only local but also network printers.

  • To start printing a document, call the startDoc function. To terminate printing, use the EndDoc function. These two functions enclose the block that carries out printing. Within the limits of that block, it is also possible to paginate the document using the StartPage and EndPage functions.

  • When printing is completed, the printer context must be deleted using the DeleteDC function.



The Assembly Programming Master Book
The Assembly Programming Master Book
ISBN: 8170088178
EAN: 2147483647
Year: 2004
Pages: 140
Authors: Vlad Pirogov

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net