L_EpnGetPrinterSaveOptions

#include "l_eprint.h"

L_INT EXT_FUNCTION L_EpnGetPrinterSaveOptions (pszPrinterName, pSavingOptions, uSize, puNeeded)

L_CHAR L_FAR * pszPrinterName;

/* printer name */

BYTE L_FAR * pSavingOptions;

/* saving options buffer */

L_UINT uSize;

/* size in bytes, of the buffer pointed to by pSavingOptions */

L_UINT L_FAR * puNeeded;

/* bytes received or required */

Receives the file save options of an ePrint printer.

Parameter

Description

pszPrinterName

Character string that contains the name of the ePrint printer.

pSavingOptions

Pointer to a buffer that receives an EPNPRINTERMULTISAVEOPTIONS structure that contains the file save options of the ePrint printer. The buffer should be large enough to receive the structure and any data to which the structure members point. If the buffer is too small, the value of the puNeeded parameter will be the required buffer size.

uSize

Size in bytes, of the buffer pointed to by pSavingOptions.

puNeeded

Pointer to a variable to be updated with the size of the retrieved file save options, in bytes. If uSize is smaller than this value, L_EpnGetPrinterSaveOptions fails, and the value will represent the required buffer size. If uSize is equal to or greater than this value, L_EpnGetPrinterSaveOptions succeeds, and the value will represent the number of bytes stored in the buffer.

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.

The user should first get the required size of the file save options for the specified printer, by passing NULL for pSavingOptions, 0 for uSize, and a valid pointer for puNeeded. The function will return the ERROR_MORE_DATA error code and the required size in the puNeeded parameter. Next, allocate the pSavingOptions buffer with the required size returned in puNeeded, and then recall the function with the valid data.

To use the retrieved pSavingOptions pointer, it should be cast as pEPNPRINTERMULTISAVEOPTIONS.

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_EpnInstallOEMPrinter, L_EpnSetPrinterSaveOptions

Topics:

ePrint: Getting and Setting Printer Specification

 

Setting and Getting ePrint Printer Settings

Example

#define TEST_PRINTER_NAME "Test Printer Name"

L_VOID GetPrinterSpecifications( EPNPRINTERSPECIFICATIONS * pSpecific ) 
{
   pSpecific->uStructSize = sizeof( EPNPRINTERSPECIFICATIONS ); 
   L_EpnGetPrinterSpecifications ( TEST_PRINTER_NAME, pSpecific ); 
}


L_VOID GetSaveOptions( EPNPRINTERMULTISAVEOPTIONS ** ppMultiSave ) 
{
   LPBYTE pBuffer = NULL; 
   L_UINT uNeeded = 0; 
   L_EpnGetPrinterSaveOptions( TEST_PRINTER_NAME, NULL, 0, & uNeeded ); 
   if( uNeeded > 0 ) 
   {
      pBuffer = (LPBYTE) GlobalAlloc( GPTR, uNeeded ); 
      if( pBuffer ) 
      {
         L_EpnGetPrinterSaveOptions( TEST_PRINTER_NAME, pBuffer, uNeeded, & uNeeded ); 
         * ppMultiSave = (EPNPRINTERMULTISAVEOPTIONS*) pBuffer; 
      }
   }
}

L_VOID GetMailMessage( EPNMAILMESSAGEINFO ** ppMailMsg ) 
{
   LPBYTE pBuffer = NULL; 
   L_UINT uNeeded = 0; 
   L_EpnGetPrinterMailMessageInfo ( TEST_PRINTER_NAME, NULL, 0, & uNeeded ); 
   if( uNeeded > 0 ) 
   {
      pBuffer = (LPBYTE) GlobalAlloc( GPTR, uNeeded ); 
      if( pBuffer ) 
      {
         L_EpnGetPrinterMailMessageInfo( TEST_PRINTER_NAME, pBuffer, uNeeded, & uNeeded ); 
         * ppMailMsg = (EPNMAILMESSAGEINFO*) pBuffer; 
      }
   }
}

L_VOID GetPrinterOptions( ) 
{
   EPNPRINTERSPECIFICATIONS Specific; 
   ZeroMemory( & Specific, sizeof( EPNPRINTERSPECIFICATIONS ) ); 
   GetPrinterSpecifications( & Specific ); 
   
   EPNPRINTERMULTISAVEOPTIONS * pMultiSave = NULL; 
   GetSaveOptions( & pMultiSave ); 
   // After Doing what you need with the pMultiSave you should free it using GlobalFree
   if( pMultiSave ) 
   {
      GlobalFree( pMultiSave ); 
      pMultiSave = NULL; 
   }
   
   EPNMAILMESSAGEINFO * pMailMsg = NULL; 
   GetMailMessage( & pMailMsg ); 
   // After Doing what you need with the pMailMsg you should free it using GlobalFree
   if( pMailMsg ) 
   {
      GlobalFree( pMailMsg ); 
      pMailMsg = NULL; 
   }
   
   /* Get Batch Printers List */
   HEPNPRINTERSLIST hPrintersList = NULL; 
   if( SUCCESS == L_EpnCreatePrintersList ( & hPrintersList ) ) 
   {
    L_EpnGetPrinterBatchPrintersList ( TEST_PRINTER_NAME, hPrintersList ); 
   }

/* Get Conflict Save */
L_INT nConflictSolve; 
EPNRENAMINGOPTIONS Renaming; 
ZeroMemory( & Renaming, sizeof( EPNRENAMINGOPTIONS ) ) ; 
Renaming.uStructSize = sizeof( EPNRENAMINGOPTIONS ); 
L_EpnGetPrinterConflictSolving
 ( TEST_PRINTER_NAME, &nConflictSolve, &Renaming ); 
}