Newsgroups: comp.windows.ms.programmer
Path: funic!news.funet.fi!sunic!psinntp!psinntp!dorsai.com!head
From: head@dorsai.com (Howard Pinsley)
Subject: Printing Multiple Pages
Message-ID: <1992Nov19.211652.10865@dorsai.com>
Organization: The Dorsai Embassy +1.718.729.5018
X-Newsreader: Tin 1.1 PL4
Date: Thu, 19 Nov 1992 21:16:52 GMT

I am adding print support to a Window's application that I'm writing.  I have
some text in an edit control that I'd like to print on as many pages as is
necessary.

What I'm currently doing is:

o Obtaining the text to print (which may be quite lengthy).
o Getting a printer device context (using the 3.1 PrintDlg function).
o Selecting a new font into the device context.
o Calling GetDeviceCaps with the printer device context to obtain the dimensions
  of the printable page (i.e. HORZRES and VERTRES).
o Setting up a RECT struct that is almost the entire printable page.
o Using DrawText with the optional rect parameter to write the text on the page   with wrapping.

The problem I'm having is when the amount of text requires that it go to
another page.  I realize that I have to have a NEWFRAME escape call between the
pages, but I can't figure out how to continue to use DrawText (which, very
nicely, wraps the text).  That is, how can I use DrawText for the top of the
text and then determine where I need to pick the text up for page two?

Do I have to abandon the simple DrawText and do wrapping computations myself?
Any insight would be appreciated.
-- 

Howard Pinsley                                             Voice: (212) 836-8322
head@dorsai.com                                              Fax: (212) 836-8689

