* * :--------------------------------------- * ------------------------: Copybook for Print-Dialog * : See the Documentation for Details * :--------------------------------------- * * To use: * * COPY WIN32API. * COPY PRINTDLG. * COPY GSPRTDEF. * * ------------------------: Load the window handle of the window * : that will own this dialog; (it's * : passed back by GUI ScreenIO when you * : display a panel). Zero is OK. * MOVE LOW-VALUES TO PRINTDIALOG-PARAMETER-AREA. * MOVE mypanel-HWND TO PRTDLG-HWNDOWNER. * SET PRTDLG-PAGES-UNKNOWN TO TRUE * SET PRTDLG-NO-PRINTER-PRESELECTION TO TRUE * ------------------------: Set the options you want * * ADD * PRTF-ALLPAGES * PRTF-USEDEVMODECOPIES * GIVING PRTDLG-FLAGS * * SET API-PRINTDIALOG TO TRUE * * ------------------------: Call the GUI ScreenIO API routine: * * CALL 'GSWINAPI' USING WIN32API-PARMS * PRINTDIALOG-PARMS * GS-DEVMODE-DATA * WIN32API-C * WIN32API-D * WIN32API-E * WIN32API-F. * * IF WIN32API-FAILED * do print-not-possible-or-canceled * ELSE * print-the-report * * ---------------------------------------------------------------- * 01 PRINTDIALOG-PARMS. 05 PRINTDIALOG-PARAMETER-AREA. * * ------------------------: Input Items * 10 FILLER PIC X VALUE LOW-VALUES. * : Recommend you use auto-cleanup unless * : you need to retain handles. See * : documentation and PRTDLG-HANDLES below 88 PRTDLG-AUTO-CLEANUP VALUES LOW-VALUE SPACE. 88 PRTDLG-RETAIN-HANDLES VALUES '1'. 88 PRTDLG-RELEASE-HANDLES VALUES '2'. * * : This must be the HWND of your main * : panel (or any panel) as provided in * : your panel copybook. REQUIRED. 10 PRTDLG-HWNDOWNER PIC X(4) VALUE LOW-VALUES. * * : If you know how many pages you will * : print, you can offer the option for * : the user to print selected ranges * : of pages. If you don't know, * : or are not prepared to print selected * : pages in your program, just set * : both to zero (PRTDLG-PAGES-UNKNOWN) * : and choice will not be offered. 10 PRTDLD-PAGES-IN-JOB VALUE '00000000'. 88 PRTDLG-PAGES-UNKNOWN VALUE '00000000'. 15 PRTDLG-MIN-PAGE PIC 9(4). 15 PRTDLG-MAX-PAGE PIC 9(4). * * : Options for the dialog box - Load this * : by adding all the options from the * : list below (See FILLER below ) into * : this field. If left zero the API * : will select PRTF-ALLPAGES. 10 PRTDLG-FLAGS PIC S9(9) COMP-5 VALUE ZERO. * * ------------------------: Input and Output Items * : * : Descriptive Information about the * : printer selected by the user. * : * : If you save these elements in a file * : or the registry and pre-load them * : in this area before making the call * : the printer selection dialog will * : "suggest" the same printer as was * : previously selected for this print * : job type, and return a device context * : (hdc) for that printer. 10 PRTDLG-PRINTER-INFORMATION VALUE LOW-VALUES. * : Set this 88 true to NOT "suggest" * : printer... (Default will appear). 88 PRTDLG-NO-PRINTER-PRESELECTION VALUE LOW-VALUES. * : Printer name of printer (not model) * : If pre-loaded, dialog will pre-select * : that printer. * : To use our PrintFile or OpenPrinter * : APIs you specify this field as the * : printer name. 15 PRTDLG-PRINTER-NAME PIC X(100). * : Device driver used. Info Only. 15 PRTDLG-PRINTER-DEVICE-DRIVER PIC X(30). * : SHARE name or PORT name of printer. * : If this field contains "FILE:" the * : user intends to print to a file and * : the system will query them for a file * : name, You need not handle that. * : If you intend to copy files to the * : printer use this as the copyfile * : target after appending a backslash and * : file name (win2k). 15 PRTDLG-PRINTER-PORT-NAME PIC X(40). * * ------------------------: Output Items * * : User Requests Collation, but printer * : can not do this automatically, so your * : program must print complete N complete * : sets. (See PRTDLG-NUM-COPIES for "N"). * : Page 1,2,3,... Page 1,2,3... etc. * : Value 0 = No, Else = Requested * : Value 1 = Requested 10 PRTDLG-SIMULATE-COLLATION PIC 9 VALUE 0. * * : If the user selects multiple copies * : but the printer driver is incapable * : of generating these copies by itself * : this field will return a number > 1 * : and your program must generate that * : number of copies. If this field is * : greater than 1 but collation (above) * : is zero, then you should print pages * : 1,1,1,1... 2,2,2,2... (uncollated) * : (You can pre-load this if you wish). 10 PRTDLG-NUM-COPIES PIC 9999 VALUE 1. * * : User requests only pages from-thru-to * : be printed. If you do not support this * : set PRTDLG-PAGES-UNKNOWN to true. 10 PRTDLG-FROM-PAGE PIC 9(4) VALUE ZERO. 10 PRTDLG-TO-PAGE PIC 9(4) VALUE ZERO. * * :--------------------------------------- * : Optional: Handle to Device Context * : and associated data areas. * : Only returned if PRTDLG-RETAIN-HANDLES * : is set true. * : Unless you know what you are doing * : Do not request these handle. If you * : do you are responsible to later * : Call this API with this copybook and * : SET PRTDLG-RELEASE-HANDLES TO TRUE * : * : IF ALL YOU WANT IS PRINTER SELECTION * : YOU DO NOT NEED THESE HANDLES. 10 PRTDLG-HANDLES VALUE LOW-VALUES. 15 PRTDLG-HDC PIC X(4). 15 PRTDLG-DEVMOD PIC X(4). 15 PRTDLG-DEVNAMES PIC X(4). * *================================================================= * : Convienence area-- Flag source. * : List of flags that we support. * : Add any of these to PRTDLG-FLAGS to * : achieve the options you want. * : You need not use any. 05 PRTF-FLAG-SOURCE. * : Select the ALL pages radio button 10 PRTF-ALLPAGES PIC 9(9) COMP-5 VALUE 0. * : Select the "selection" radio button 10 PRTF-SELECTION PIC 9(9) COMP-5 VALUE 1. * : Select the Page-nums radio button * : It would be silly to do this when you * : have PRTDLG-PAGES-UNKNOWN set to true. 10 PRTF-PAGENUMS PIC 9(9) COMP-5 VALUE 2. * : disable the Selection radio button 10 PRTF-NOSELECTION PIC 9(9) COMP-5 VALUE 4. * : Sets the Collate checkbox 10 PRTF-COLLATE PIC 9(9) COMP-5 VALUE 16. * : Selects the Print to file checkbox 10 PRTF-PRINTTOFILE PIC 9(9) COMP-5 VALUE 32. * : Selects the Print Setup Display * : on Win2k/Xp - no effect on Win9x 10 PRTF-PRINTSETUP PIC 9(9) COMP-5 VALUE 64. * : Dont warn of no default printer 10 PRTF-NOWARNING PIC 9(9) COMP-5 VALUE 128. * : Don't show dialog, just return default * : printer info, No Choice offered, and * : the HDC returned will be for the * : default printer, if any. 10 PRTF-RETURNDEFAULT PIC 9(9) COMP-5 VALUE 1024. * : If your application is not prepared * : print copies or collate add this * : value. It will suppress the copies * : and collate options unless the printer * : driver can handle these functions by * : itself. 10 PRTF-USEDEVMODECOPIES PIC 9(9) COMP-5 VALUE 262144. * : Do not offer print to file option. 10 PRTF-HIDEPRINTTOFILE PIC 9(9) COMP-5 VALUE 1048567. *