SAMPLE: Printing Text Reports

Last reviewed: February 15, 1996
Article ID: Q69078
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows versions 3.0 and 3.1

SUMMARY

The sample program REPMKR in the Microsoft Software Library demonstrates the code required to print a report. The report generator prints plain-text reports in monospace fonts either on a printer or in a print-preview window. The code to handle printer display contexts is encapsulated in the report generator code. The interface does not require the host program to work 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.

Download REPMKR.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download REPMKR.EXE (size: 40057 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \SOFTLIB\MSLFILES directory
          Get REPMKR.EXE (size: 40057 bytes) 
    

MORE INFORMATION

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 demonstrates how to use these functions.

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


Additional reference words: 3.00 3.10 softlib REPMKR.EXE
KBCategory: kbprg kbfile
KBSubcategory: GdiPrn


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.