PEPrintReport Arguments
PEPrintReport is declared in CRPE.H as follows:
short FAR PASCAL PEPrintReport (
char FAR *reportFilePath,
BOOL toDefaultPrinter,
BOOL toWindow, char FAR *title,
int left, int top,
int width, int height,
DWORD style, HWND parentWindow);
The following table describes each argument:
| Parameter
| Description
|
reportFilePath
| The name of the report to be printed. Include the path if the report is not in the current directory. The report name can be hard-coded and unchangeable at runtime, or you can pass a string variable or character array as the result of a user choice.
|
toDefaultPrinter
| If toDefaultPrinter is set to TRUE (1), the report is sent to a printer. The toWindow argument should be set to FALSE.
|
toWindow
| If toWindow is set to TRUE (1), the report is sent to a preview window. The toDefaultPrinter argument should be set to FALSE.
|
title
| The title that you want to appear in the window title bar. This argument can receive a string variable or a character array at runtime.
|
left
| The position, in current screen coordinates, at which you want the left edge of the preview window to appear if the report is being printed to a window. Current screen coordinate measurements can be set within your application.
|
top
| The position, in current screen coordinates, at which you want the top edge of the preview window to appear if the report is being printed to a window. Current screen coordinate measurements can be set within your application.
|
width
| The width of your preview window, in current screen coordinates, if the report is being printed to a window. Current screen coordinate measurements can be set within your application.
|
height
| The height of your preview window, in current screen coordinates, if the report is being printed to a window. Current screen coordinate measurements can be set within your application.
|
style
| The style setting, as defined in WINDOWS.H. Style settings can be combined using the bitwise OR operator. These are standard Windows styles. Refer to Windows API documentation for complete information on window styles. Use 0 for default style settings.
|
parentWindow
| Specifies the window handle for the parent window to be used for this preview window.
|
When designing a Print-Only Link using PEPrintReport, keep the following points in mind:
- If toDefaultPrinter = True, and if you have specified a printer in the report using the Printer Setup command, PEPrintReport prints to the specified printer. Otherwise it prints to the Windows default printer. If you wish to override both the printer specified in the report and the Windows default printer, you will need to establish a Custom-Print Link and specify the printer using the PESelectPrinter function.
- If toDefaultPrinter = True, you may enter null values for all of the remaining parameters except reportFilePath because they apply to printing to a preview window only. The title parameter requires a null string (i.e., ""), while the rest of the parameters will accept 0 (zero).
- If parentWindow is null, Crystal Reports creates a top level window. The top left corner specified is relative to the origin of the screen.
- If parentWindow is the handle of an MDI frame window, Crystal Reports creates a preview window that is an MDI child window with the top left corner relative to the origin of the frame window's client area.
- If parentWindow is the handle of some other window, Crystal Reports creates a preview window that is a child of that window with the top left corner specified relative to the origin of the parent window's client area.
- You can use the Windows constant CW_USEDEFAULT (-32768) as the value of left, top, width, and height to indicate a default position for the preview window.
If the preview window is a top-level window and the window style is defined as 0 (i.e., the final two parameters in the PEPrintReport call are 0, 0) or, if the preview window is an MDI child window and the window style is defined as 0, Crystal Reports uses the following default style:
(WS_VISIBLE | WS_THICKFRAME | WS_SYSMENU | WS_MAXIMIZEBOX |
WS_MINIMIZEBOX)
That is, the default window is a visible window with a thick frame that can be used for sizing the window. The window includes a system menu box, and maximize and minimize buttons.