#include "l_eprint.h"
L_INT EXT_FUNCTION L_EpnRegisterCallback (pszPrinterName, nType, pCallbackInfo, pIDInfo)
/* printer name */ | |
EEPRINTCALLBACKTYPE nType; |
/* callback type */ |
/* pointer to a callback information structure */ | |
EPNCALLBACKIDINFO L_FAR * pIDInfo; |
/* callback identifier */ |
Registers and enables the fireing of the callback functions.
Parameter |
Description |
|
pszPrinterName |
Character string that contains the name of the ePrint printer. |
|
nType |
Value that represents the callback type to be registerd. Possible types are: |
|
|
Value |
Meaning |
|
EPRINT_CALLBACKS_IMG |
[0] Enable firing EMFRGSPROC and RASRGSPROC callback functions to get a printed job as an EMF data file or DIB. |
|
EPRINT_CALLBACKS_UI |
[1] Enable firing the SHOWUIPROC callback function to handle the user interface as needed in the toolkit. |
|
EPRINT_CALLBACKS_JOB |
[2] Enable firing JOBINFOPROC and SAVESTATUSPROC callback functions to get information about a printed job or file save status. |
pCallbackInfo |
Pointer to a structure that contains information about the callback function to be registered. The structure passed depends upon the value of the nType parameter. This pointer points to one of the following structures: |
|
|
Structure |
Usage |
|
EPNIMGCALLBACKINFO |
When nType is set to EPRINT_CALLBACKS_IMG. |
|
EPNUICALLBACKINFO |
When nType is set to EPRINT_CALLBACKS_UI. |
|
EPNJOBCALLBACKINFO |
When nType is set to EPRINT_CALLBACKS_JOB. |
pIDInfo |
Pointer to an EPNCALLBACKIDINFO structure to be updated with information about the callback to be registered. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Support for Basic functionality must be unlocked by calling the L_EpnUnlockSupport function before using this function.
Note that you should initialize the COM library by calling the CoInitialize Windows C DLL when you want start dealing with callbacks. After you are finished dealing with callbacks you should release the COM library by calling the CoUninitialize Windows C DLL.
Required DLLs and Libraries
LPKRN For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to ePrint Files. |
See Also
Functions: |
L_EpnUnRegisterCallback, EMFRGSPROC, RASRGSPROC, SHOWUIPROC, JOBINFOPROC, SAVESTATUSPROC |
Topics: |
|
|
Example
/* Job Callback */
L_INT EXT_CALLBACK JobStatus( L_CHAR * pszPrinter,
DWORD dwJobID,
DWORD dwFlags,
L_VOID * pData )
{
L_CHAR szResult[ 250 ];
wsprintf( szResult, "Job ID: %d.\nOn printer: ", dwJobID );
strcat( szResult, pszPrinter );
switch( dwFlags )
{
case EPRINT_JOB_START:
MessageBox( NULL, szResult, "Starting", MB_OK );
break;
case EPRINT_JOB_END:
MessageBox( NULL, szResult, "Ending", MB_OK );
break;
}
return 1;
}
L_INT EXT_CALLBACK SaveStatus( L_CHAR * pszPrinter,
L_CHAR * pszFileName,
DWORD lErrorCode,
L_VOID * pData )
{
L_CHAR szMessage[250];
strcpy( szMessage, "Saving file: " );
strcat( szMessage, pszFileName );
strcat( szMessage, ".\n On printer: " );
strcat( szMessage, pszPrinter );
if( 1 == lErrorCode )
{
MessageBox( NULL, szMessage, "Saving succeeded", MB_OK );
}
else
{
MessageBox( NULL, szMessage, "Saving failed", MB_OK );
}
return 1;
}
EPNCALLBACKIDINFO JOBIDInfo;
/* Note that you should call CoInitialize( NULL ) before calling the L_EpnRegisterCallback */
L_VOID RegisterJobCallback( )
{
EPNJOBCALLBACKINFO Job;
ZeroMemory( & Job, sizeof( EPNJOBCALLBACKINFO ) );
Job.uStructSize = sizeof( EPNJOBCALLBACKINFO );
Job.pData = NULL;
Job.pfnJobInfoCallBack = & JobStatus;
Job.pfnSaveStatusCallBack = & SaveStatus;
ZeroMemory( & JOBIDInfo, sizeof( EPNCALLBACKIDINFO ) );
JOBIDInfo.uStructSize = sizeof( EPNCALLBACKIDINFO );
L_EpnRegisterCallback( "Test Printer Name", EPRINT_CALLBACKS_JOB, & Job, & JOBIDInfo );
}
/* Note that you should call CoUninitialize( ) after calling the L_EpnUnRegisterCallback if this is the last registered callback. */
L_VOID UnRegJobCallback( )
{
L_EpnUnRegisterCallback ( & JOBIDInfo );
}