RepMgr.exe Manages Printing Reports in Applications

ID: Q75110


The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) 3.1


SUMMARY

RepMgr.exe is a file in the Microsoft Software Library that contains source code for a Windows module that manages the generating of reports from an application. The following seven services are provided:

  • Printing textual data in a fixed-pitch font


  • Numbering each page of the report


  • Printing headers and footers and the date on each page


  • Activating the appropriate printer-setup dialog box


  • Activating a printer selection dialog box


  • Printing some very simple graphics


  • Providing a basic Print Preview operation


The following is a list of three enhancements that one might add to provide additional functionality:
  • Provide support for proportional fonts with tabs


  • Print bitmap graphics


  • Format the text


This article discusses the services that this module provides and contains a code fragment that demonstrates using some of the services to print a simple report.


MORE INFORMATION

The following files are available for download from the Microsoft Download Center. Click the file names below to download the files:


RepMgr.exe

For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address

http://www.microsoft.com/downloads/search.asp
and then click How to use the Microsoft Download Center.

The interface to the report generator is as follows:

   BOOL PrinterControl(int iCommand, int iParam, LPSTR szParam); 
Functions:

   iCommand         iParam                 szParam
   --------         ------                 -------
   PC_SETCOLS       # of columns           Not used
   PC_SETROWS       # of rows              Not used
   PC_PRINT         Not used               Not used
   PC_CLEARALL      Not used               Not used
   PC_ADDLINE       -1 for next line,
                    (n) for line # to add  LPSTR to line
   PC_ADDBAR        -1 for width of page,  LPSTR to character
                    (n) for bar width      (NULL = '-')
   PC_SETPAGENUM    Page number            Not used
   PC_SETHEADERn    Not used               LPSTR to header, NULL = clear
   PC_ADDHEADERn    Not used               Not used
   PC_SETFOOTER1    Not used               LPSTR to header, NULL = clear
   PC_ADDFOOTER1    Not used               Not used
   PC_STARTJOB      Not used               Not used
   PC_ENDJOB        TRUE = OK,
                    FALSE = Abort          Not used
   PC_SETTITLE      Not used               LPSTR to title
   PC_SETPRINTMODE  PC_CODE_PRINT or
                    PC_CODE_PREVIEW        Not used
   PC_GRAPHICS      Not used               LPGRAPHPARAMBLOCK 
The following code prints a sample report:

   void DoSampleReport (int iMode)

   {

   int  i;
   char szText[80];

   PrinterControl(PC_SETPRINTMODE, iMode, 0L);
   PrinterControl(PC_SETCOLS, 80, 0L);
   PrinterControl(PC_SETROWS, 55, 0L);

   PrinterControl(PC_SETHEADER1, 0, "Header #1");
   PrinterControl(PC_SETHEADER2, 0, "Header #2");
   PrinterControl(PC_SETHEADER3, 0, "Header #3");

   PrinterControl(PC_SETTITLE, 0, "Sample Report");
   PrinterControl(PC_STARTJOB, 0, 0L);
   PrinterControl(PC_CLEARALL, 0, 0L);

   PrinterControl(PC_ADDBAR, -1, "=");
   PrinterControl(PC_ADDLINE, -1, "Added line");

   for (i = 0; i < 100; i++)
     {
     wsprintf(szText, "Loop Added Line #%d", i + 1);
     PrinterControl(PC_ADDLINE, -1, szText);
  }

   PrinterControl(PC_ADDBAR, -1, "=");
   PrinterControl(PC_PRINT, CUR_PRINT_MODE, NULL);

   PrinterControl(PC_ENDJOB, HARDCOPYONLY, NULL);

   } 
The following functions are provided to set up and select the printer:

   PrinterSetupDialog();
   PrinterSelectDialog(); 

Additional query words:

Keywords : kbfile kbprint kbsample kbGDI kbDSupport kbSDKWin16
Version : WINDOWS:3.1
Platform : WINDOWS
Issue type : kbinfo


Last Reviewed: December 8, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.