Printing Text Reports

This article was previously published under Q69078
This article has been archived. It is offered "as is" and will no longer be updated.
The sample program REPMKR in the Microsoft Download Center demonstratesthe code required to print a report. The report generator prints plain-textreports in monospace fonts either on a printer or in a print-previewwindow. The code to handle printer display contexts is encapsulated in thereport generator code. The interface does not require the host program towork with printing code.

NOTE: This sample was originally written for Windows 3.0. Applications targeted for Windows 3.1 should modify this sample's code to utilize the Common Dialog boxes.
The following file is available for download from the Microsoft Download Center:
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
The three functions of the report generator are as follows:
   Function                        Description   --------                        -----------   PrinterSetupDialog(void)        Brings up the standard Printer                                   Setup dialog box   PrinterSelectDialog(void)       Allows the user to select a printer                                   for use by the report generator   PrinterControl(int iCommand,    Controls page layout      int iParam, LPSTR szParam)				
The following is the table of specific commands:
   iCommand         iParam                 szParam   --------         ------                 -------   PC_SETCOLS       # of columns/page      Not used   PC_SETROWS       # of rows/page         Not used   PC_PRINT         Not used               Not used   PC_CLEARALL      Not used               Not used   PC_ADDLINE       -1 for next line,      LPSTR to line of text                    (n) for line # to add   PC_ADDBAR        -1 for width of page   LPSTR to character                    (n) for bar width      (NULL will print '-')   PC_SETPAGENUM    Page number            Not used   PC_SETHEADERn    Not used               LPSTR to header,                                           NULL will clear   PC_ADDHEADERn    Not used               Not used   PC_SETFOOTER1    Not used               LPSTR to header,                                           NULL will clear   PC_ADDFOOTER1    Not used               Not used   PC_STARTJOB      Not used               Not used   PC_ENDJOB        TRUE = OK,             Not used                    FALSE = Abort   PC_SETTITLE      Not used               LPSTR to title                                           of print job   PC_SETPRINTMODE  PC_CODE_PRINT or       Not used                    PC_CODE_PREVIEW				
In the REPMKR archive file is a sample program BASE that demonstrateshow to use these functions.

Each header is printed on every page, unless it is set to NULL. Eachfooter is printed on every page, unless it is set to NULL. The titleof the print job is displayed in the "printing" message box.

Article ID: 69078 - Last Review: 08/23/2013 18:23:23 - Revision: 2.3

  • Microsoft Windows Software Development Kit 3.1
  • kbnosurvey kbarchive kbdownload kb16bitonly kbfile kbinfo kbsample KB69078