Share via


CPrintDialog::PrintCollate

BOOLPrintCollate()const;

Return Value

Nonzero if the user selects the collate check box in the dialog box; otherwise 0.

Remarks

Call this function after calling DoModal to determine whether the printer should collate all printed copies of the document.

Example

// Display the Windows Print dialog box with Collate check box checked.
CPrintDialog dlg(FALSE, PD_ALLPAGES | PD_COLLATE | PD_NOPAGENUMS | PD_HIDEPRINTTOFILE);
if (dlg.DoModal() == IDOK)
{
   // If the collate check box is selected, then GetCopies() will return
   // the number of copies printed. Otherwise, GetCopies() always
   // returns 1. Then, the number of copies printed can be found from the
   // DEVMODE structure of the printing device.
   if (dlg.PrintCollate())
   {
      int num = dlg.GetCopies();
      TRACE("Number of copies printed = %d\n", num);
   }
   else
   {
      LPDEVMODE devmode = dlg.GetDevMode();
      TRACE("Number of copies printed = %d\n", devmode->dmCopies);
   }
}

CPrintDialog OverviewClass MembersHierarchy Chart

See Also   CPrintDialog::GetCopies