TerRegisterPrintCallback
Register a callback for the TerMergePrint function.
BOOL TerRegisterPrintCallback(PrintCallback)
PRINT_CALLBACK PrintCallback; | The callback process in your application to receive the TerMergePrint message. Set to NULL to reset the callback procedure. |
Description: This function can be used to register a callback procedure before calling the TerMergePrint function. When such a callback procedure is set, the TerMergePrint function calls this procedure immediately after creating a hidden TER window and after reading the specified file or buffer. Your callback procedure should have the following syntax:
int PrintCallback(HWND hParentWnd, HWND hTerWnd)
The TerMergePrint function sets the 'hParentWnd' argument to the parent window handle as specified in the StrPrint structure. The 'hTerWnd' argument is set to the window handle of the hidden TER window. The return value from the callback function is not used by the TerMergePrint function.
Return Value: This function returns TRUE when successful.
Comments: This function is not available as an ActiveX control method. It must be used as a DLL function.
Example:
Normally, the TerMergePrint function can not print the HTML file. But this example uses the print callback function and HTML Add-on to print an HTML file.
TerRegisterPrintCallback(PrintCallback); // set the callback
struct StrPrint print;
print.rect=... // set the StrPrint structure
print.OnePage=...
....
....
print.InputType='F';
lstrcpy(print.file,""); // do not specify the HTML file here
TerMergePrint(&print);
PrintCallback(HWND hParentWnd, HWND hTerWnd)
{
HtsInitialize(hTerWnd,hParentWnd);
HtsRead(hTerWnd,HTML_FILE,"test.htm",NULL,0,NULL);
}