SAMPLE: Code Sample Manages Printing Reports in ApplicationsLast reviewed: February 15, 1996Article ID: Q75110 |
The information in this article applies to:
SUMMARYREPMGR is a file in the 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:
MORE INFORMATIONThe 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();Download REPMGR.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:
|
Additional reference words: 3.10 softlib REPMGR.EXE
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |