Using WinPrint 2 without the cWinReport2 Class
The easiest way to use WinPrint is through the class wrappers provided by the DataFlex class library. WinPrint 1 and WinPrint 2 are specifically designed to work together in the same application. This design works best when you are using the provided report classes for each reporting engine. When you do this, your application should automatically determine which WinPrint engine to use for which report.
For WinPrint 2, you would create objects based on the cWinReport2 class. For WinPrint 1, you would create objects based on the WinReport class.
See Building WinPrint 2 Reports for more information.
If you are using WinPrint 2 without the cWinReport2 class wrapper, there are additional considerations to keep in mind.
Use Package
To utilize WinPrint 2 manually, you need to include the DataFlex package WinPrint2.pkg in your application:
Use WinPrint2.pkg
This package declares the necessary global object that wraps all calls to the WinPrint2 API.
Global WinPrint Object
WinPrint 2 uses a global object to wrap API calls to the WinPrint 2 DLL. A handle to the WinPrint 2 global object is stored in the global variable ghoWinPrint2. If you are not using the cWinReport2 class, you will need to send messages to this object:
Send DFNewDoc of ghoWinPrint2 True
Document Control
WinPrint 2 requires strict document control. If you are not using the cWinReport2 class, each report you create must begin by sending DFNewDoc and finish by sending DFEndDocument to the global WinPrint 2 object. This was not necessary with WinPrint 1.
The DFPreview and DFPrint messages must be sent after DFEndDocument. This was also not necessary with WinPrint 1.