Udostępnij za pośrednictwem


CView::DoPreparePrinting

Call this function from your override of OnPreparePrinting to invoke the Print dialog box and create a printer device context.

BOOL DoPreparePrinting(
   CPrintInfo* pInfo 
);

Parameters

  • pInfo
    Points to a CPrintInfo structure that describes the current print job.

Return Value

Nonzero if printing or print preview can begin; 0 if the operation has been canceled.

Remarks

This function's behavior depends on whether it is being called for printing or print preview (specified by the m_bPreview member of the pInfo parameter). If a file is being printed, this function invokes the Print dialog box, using the values in the CPrintInfo structure that pInfo points to; after the user has closed the dialog box, the function creates a printer device context based on settings the user specified in the dialog box and returns this device context through the pInfo parameter. This device context is used to print the document.

If a file is being previewed, this function creates a printer device context using the current printer settings; this device context is used for simulating the printer during preview.

Requirements

Header: afxwin.h

See Also

Reference

CView Class

Hierarchy Chart

CPrintInfo Structure

CView::OnPreparePrinting

Other Resources

CView Members