Select the product you need help with
How To Print from a Class Other Than CViewArticle ID: 133275 - View products that this article applies to. This article was previously published under Q133275 On This PageSUMMARY
The standard method to support printing capability in an MFC application is
to override the OnDraw(CDC* pDC) member function of the CView class that
provides the pointer to the device context (pDC). If the application does
not possess a CView class (for example, a dialog-based application), you
can use the code listed in this article to obtain a pointer to the printing
device context to implement printing.
MORE INFORMATION
In this example, CMyDialog is publicly derived from CDialog, OnPrintBuf()
is a message handler that is mapped to BN_CLICKED, and SetPrintAlign() is
used to select print settings specified to an application. The sample code
prints the contents of the 'pbuf' buffer.
Sample CodeREFERENCES
For more information about the MFC printing, please see "Programming with
the Microsoft Foundation Class Library" in Books Online.
PropertiesArticle ID: 133275 - Last Review: November 21, 2006 - Revision: 3.2 APPLIES TO
|



Back to the top








