L_PrnClntStartup

#include "LtprinterClient.h"

L_LTPRINTERCLIENT_API L_BOOL EXT_FUNCTION L_PrnClntStartup(pszPrinterName, pbtInitialData, dwLenght, ppUserData)

L_TCHAR * pszPrinterName;

printer's name

L_UCHAR * pbtInitialData;

printer initialization data

L_ULONG dwLenght;

length of initialization data

L_VOID ** ppUserData;

pointer to additional parameters

Callback function to be fired by the printer driver as a job is being initialized.

Parameter

Description

pszPrinterName

Character string that contains the printer's name.

pbtInitialData

Pointer to a byte array that holds the initialization data set in the server machine.

dwLenght

Size of the initialization data in the pbtInitialData.

ppUserData

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

Returns

TRUE

The job will be continued.

FALSE

The job will be cancelled.

Comments

The L_PrnClntStartup callback function will be fired from the printer driver, which will call this function with the pbtInitialData that contains a byte array that holds the initialization data specified for this printer.

If the user sets the value of ppUserData, the value of ppUserData will be received in the other callback functions.

The user must implement this function in the user demo DLL.

This function should be exported in the DLL module definition (def) file.

Required DLLs and Libraries

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

Platforms

Win32, x64.

See Also

Functions:

L_PrnClntShutdown, L_PrnClntPrintJob, L_PrnClntSetPrinterConnectionDll

Topics:

Working with the LEADTOOLS Network Virtual Printer Driver

Example

//This should be included in the client demo DLL 
//Dont forget to include These functions in the Module Definition file (def) for this dll 
//These functions does not have ASCII versions 
L_BOOL EXT_FUNCTION L_PrnClntStartup(const L_WCHAR *pszPrinterName, L_UCHAR * pbtInitialData, 
L_ULONG dwLenght, L_VOID ** ppUserData) 
{ 
   UNREFERENCED_PARAMETER(dwLenght); 
   UNREFERENCED_PARAMETER(pbtInitialData); 
   //Function will get called as printer job starts 
   WCHAR szMessage[1024]; 
   //set any user-defined data to ppUserData 
   TCHAR * szAdditionalMessage = TEXT("additional user data"); 
   *ppUserData = malloc(_tcslen(szAdditionalMessage) * sizeof(TCHAR)); 
   memset(*ppUserData,0, _tcslen(szAdditionalMessage) * sizeof(TCHAR)); 
   memcpy(*ppUserData, szAdditionalMessage, _tcslen(szAdditionalMessage) * sizeof(TCHAR)); 
   wsprintfW(szMessage, L"Job received from printer %s", pszPrinterName); 
   MessageBoxW(NULL, szMessage, L"Printer Client Demo", 0); 
   return TRUE; 
} 
L_VOID EXT_FUNCTION L_PrnClntShutdown(const L_WCHAR *pszPrinterName, L_VOID * pUserData) 
{ 
   //Function will get called when job finishes 
   WCHAR szMessage[1024]; 
   wsprintfW(szMessage, L"Job ended from printer %s", pszPrinterName); 
   MessageBoxW(NULL, szMessage, L"Printer Client Demo", 0); 
   //free the allocated user data 
   free(pUserData); 
} 
L_BOOL EXT_FUNCTION L_PrnClntPrintJob(PRNJOBDATA* pPrintJobData, L_VOID * pUserData) 
{ 
   //Function will get called when job is being printer 
   WCHAR szMessage[1024]; 
   wsprintfW(szMessage, L"Job name %s", pPrintJobData->szPrintJobName); 
   MessageBoxW(NULL, szMessage, L"Printer Client Demo", 0); 
   //cast the user data to the appropriate format 
   TCHAR * szAdditionalMessage = (TCHAR*)pUserData; 
   MessageBox(NULL, szAdditionalMessage, TEXT("User additional data"), 0); 
   char *pszMessage = "Network Printer"; 
   pPrintJobData->hUserData = GlobalAlloc(GHND, strlen(pszMessage)); 
   PVOID pVoid = GlobalLock(pPrintJobData->hUserData); 
   memcpy(pVoid, pszMessage, strlen(pszMessage)); 
   GlobalUnlock(pPrintJobData->hUserData); 
   pPrintJobData->uUserDataSize = (L_LONG)strlen(pszMessage); 
   return TRUE; 
} 

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