Microsoft KB Archive/75110

From BetaArchive Wiki

RepMgr.exe Manages Printing Reports in Applications

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:


RepMgr.exe

For additional information about how to download Microsoft Support files, click the article number below to view the article in the Microsoft Knowledge Base:

Q119591 How to Obtain Microsoft Support Files from Online Services

Microsoft used the most current virus detection software available on the date of posting to scan this file for viruses. Once posted, the file is housed on secure servers that prevent any unauthorized changes to the file.



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 _IK kbSDKWin16
Issue type : kbinfo
Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310


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