RepMgr.exe Manages Printing Reports in Applications

ID: Q75110


The information in this article applies to:


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:

The following is a list of three enhancements that one might add to provide additional functionality: 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 file is available for download from the Microsoft Software Library:

~ RepMgr.exe
For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 How to Obtain Microsoft Support Files from Online Services
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: July 2, 1999