Click here to Skip to main content
15,887,854 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HHow does one determine the pages to print if PD_SELECTION OR PD_PAGENUMS flag is set in th PRINTDLG box before activating the print common dialogue.?

Typically, the programmer sets the PD_SELLECTION or PD_PAGENUMS flag before activating the print common dialogue box. How does one tell what pages to print.

The documentation of the PRINTDLG structure is shown.here[^]

What I have tried:

I have visited microsoft.learn website. No details were given.
Posted
Updated 1-Jan-24 20:46pm

1 solution

The user selects whether to print all, range or selected, when the dialog is shown. Then when they press OK, you need to check whether any of these are true, and select the pages to print from the returned values.
 
Share this answer
 
Comments
Gbenbam 2-Jan-24 12:12pm    
How does one know the pages to print? How does one Check if any of the values are true.
Richard MacCutchan 2-Jan-24 12:52pm    
Check which flags are set when the dialog returns TRUE. If PD_PAGENUMS or PD_SELECTION is set then the nFromPage and nToPage fields give you the values. If neither of those flags is set then you should print all pages. The documentation for PRINTDLGA (commdlg.h) - Win32 apps | Microsoft Learn[^] shows this.
Gbenbam 17-Jan-24 17:17pm    
Iam sorry I just seeing this now. Want I want to ask is this: if the user selected pages 3,5,7,10 and 25. How does one use nFromPage and noPage to print such a selection since it is not a "coninuous range"?
Richard MacCutchan 18-Jan-24 4:37am    
You cannot do that with the PRINTDLG structure and its associated system call. You need to use the PRINTDLGEXA structure (commdlg.h) - Win32 apps | Microsoft Learn[^] and the PrintDlgEx function (Windows) | Microsoft Learn[^]. You then need to provide enough elements in the PRINTDLGEX.lpPageRanges array for the number of separate sets that the user may choose.
Gbenbam 18-Jan-24 8:22am    
Thanks, I'll check it out.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900