Skip to content

InitPageRanges - cPrintDialog

Methods - Properties

Method Type

Procedure

Arguments

Argument Description
iPages Highest page number printable

Description

When PD_NOPAGENUMS is not set via piFlags and no page range is set, it results in a Windows invalid parameter error (error code 0x80070057). Therefore, the cPrintDialog class contains this method, which gets called from PrintReport.

The following logic is applied:

  • A page range from 1 to iPages is created when the application developer did not create at least one page range.
  • The nToPage member of each page range element will be changed to iPages when it is larger than iPages.
  • The nFromPage member of each page range element will be changed to iPages when it is larger than iPages.
  • When a page range with a descending page number set is created, it will be corrected. This way, a page range from 5-4 will be corrected to 4-5.

Unless one needs a different default, there is no need to ever look at this routine.