L_PrnRegisterJobCallback

#include "Ltprinter.h"

L_LTPRINTER_API L_INT EXT_FUNCTION L_PrnRegisterJobCallback(pszPrinterName, fnJobInfoCallBack, pData)

L_TCHAR * pszPrinterName;

printer name

PRNJOBINFOPROC fnJobInfoCallBack;

pointer to a Job callback

L_VOID * pData;

pointer to additional parameters

Registers and enables the firing of the job callback function.

Parameter

Description

pszPrinterName

Character string that contains the name of the LEADTOOLS Virtual Printer Driver.

fnJobInfoCallBack

Callback function to be registered. This callback function gets the Started and ended of printed job.

pData

Void pointer that you can use to pass one or more additional parameters that the callback function(s) needs.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

Initialize the COM library by calling the CoInitialize Windows C API before using callbacks. After you are finished using the callbacks release the COM library by calling the CoUninitialize Windows C API.

Required DLLs and Libraries

LTPRINTER

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your LEADTOOLS Virtual Printer Driver Application.

Platforms

Win32, x64.

See Also

Functions:

L_PrnUnRegisterJobCallback, PRNJOBINFOPROC

Topics:

LEADTOOLS Virtual Printer: Register and Un-register Callback Functions

 

Working with the LEADTOOLS Virtual Printer Driver

Example

/* Job Callback */ 
L_INT EXT_CALLBACK OnJobInfoProc(L_WCHAR *  pszPrinter, 
DWORD    dwJobID, 
DWORD    dwFlags, 
L_VOID * pData) 
{ 
   UNREFERENCED_PARAMETER(pData); 
   L_WCHAR szResult[ 250 ]; 
   wsprintfW( szResult, L"Job ID: %d.\nOn printer: ", dwJobID ); 
   lstrcatW( szResult, pszPrinter ); 
   switch( dwFlags ) 
   { 
      case PRN_JOB_START: 
      MessageBoxW( NULL, szResult, L"Starting", MB_OK ); 
      break; 
      case PRN_JOB_END: 
      MessageBoxW( NULL, szResult, L"Ending", MB_OK ); 
      break; 
default: 
      { 
         L_TCHAR szPrinter[_MAX_PATH]; 
         memset(szPrinter, 0, sizeof(szPrinter)); 
#if defined(FOR_UNICODE) 
         wcscpy_s(szPrinter, pszPrinter); 
#else 
         size_t num = 0; 
         wcstombs_s(&num, szPrinter, pszPrinter, _MAX_PATH); 
#endif // #if !defined(FOR_UNICODE) 
         L_PrnCancelPrintedJob(szPrinter, dwJobID); 
      } 
   } 
   return 1; 
} 
L_INT RegistrationJobCallback( ) 
{ 
   int nRet = L_PrnRegisterJobCallback(TEXT("TEST LEADTOOLS Printer"),OnJobInfoProc,NULL); 
   if (nRet == SUCCESS) 
   { 
      L_PrnUnRegisterJobCallback(TEXT("TEST LEADTOOLS Printer")) ; 
   } 
   return nRet; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help