SplSetQueue: Difference between revisions
Appearance
Created page with "This function modifies the configuration of a print queue. == Syntax == SplSetQueue(pszComputerName, pszQueueName, ulLevel, pBuf, cbBuf, ulParmNum); == Parameters == ;pszCo..." |
|||
| Line 211: | Line 211: | ||
== Related Functions == | == Related Functions == | ||
*[[SplCreateQueue]] | *[[SplCreateQueue]] | ||
*[[ | *[[SplEnumDevice]] | ||
*[[SplEnumDriver]] | *[[SplEnumDriver]] | ||
*[[SplEnumQueue]] | *[[SplEnumQueue]] | ||
Revision as of 18:47, 28 February 2020
This function modifies the configuration of a print queue.
Syntax
SplSetQueue(pszComputerName, pszQueueName, ulLevel, pBuf, cbBuf, ulParmNum);
Parameters
- pszComputerName (PSZ) - input
- Name of computer where queue is to be modified.
- A NULL string specifies the local workstation.
- pszQueueName (PSZ) - input
- Queue name.
- ulLevel (ULONG) - input
- Level of detail required.
- This must be 3 or 6.
- pBuf (PVOID) - input
- Buffer.
- If ulParmNum is 0, this parameter must contain a complete PRQINFO3 or PRQINFO6 structure. Otherwise, it must contain a valid new value for the parameter of the PRQINFO3 or the PRQINFO6 structure indicated in ulParmNum.
- cbBuf (ULONG) - input
- Size, in bytes, of Buffer.
- ulParmNum (ULONG) - input
- Parameter number.
- Specifies either that the entire PRQINFO3 or PRQINFO6 structure is to be modified, or that only one specific parameter is to be modified.
- Possible values for this parameter are as follows:
Parameter Constant (Value) uPriority PRQ_PRIORITY_PARMNUM (2) uStartTime PRQ_STARTTIME_PARMNUM (3) uUntilTime PRQ_UNTILTIME_PARMNUM (4) pszSepFile PRQ_SEPARATOR_PARMNUM (5) pszPrProc PRQ_PROCESSOR_PARMNUM (6) pszParms PRQ_PARMS_PARMNUM (8) pszComment PRQ_COMMENT_PARMNUM (9) fsType PRQ_TYPE_PARMNUM (10) pszPrinters PRQ_PRINTERS_PARMNUM (12) pszDriverName PRQ_DRIVERNAME_PARMNUM (13) pDriverData PRQ_DRIVERDATA_PARMNUM (14) pszRemoteComputerName PRQ_REMOTE_COMPUTER_PARMNUM (15) pszRemoteQueueName PRQ_REMOTE_QUEUE_PARMNUM (16)
Returns
- rc (SPLERR) - returns
- Return code.
- NO_ERROR (0)
- No errors occurred.
- ERROR_ACCESS_DENIED (5)
- Access is denied.
- ERROR_NOT_SUPPORTED (50)
- This request is not supported by the network.
- ERROR_BAD_NETPATH (53)
- The network path cannot be located.
- ERROR_INVALID_PARAMETER (87)
- An invalid parameter is specified.
- ERROR_INVALID_LEVEL (124)
- The level parameter is invalid.
- NERR_NetNotStarted (2102)
- The network program is not installed.
- NERR_RedirectedPath (2117)
- The operation is invalid on a redirected resource.
- NERR_BufTooSmall (2123)
- The API return buffer is too small.
- NERR_QNotFound (2150)
- The printer queue does not exist.
- NERR_DestNotFound (2152)
- The printer destination cannot be found.
- NERR_DestNoRoom (2157)
- The maximum number of printer destinations has been reached.
- NERR_DestInvalidState (2162)
- This operation cannot be performed on the print destination.
- NERR_SpoolNoMemory (2165)
- A spooler memory allocation failure occurred.
- NERR_DriverNotFound (2166)
- The device driver does not exist.
- NERR_DataTypeInvalid (2167)
- The datatype is not supported by the processor.
- NERR_ProcNotFound (2168)
- The queue processor is not installed.
- NERR_BadDev (2341)
- The requested device is invalid.
- NERR_CommDevInUse (2343)
- The requested device is invalid.
- NERR_InvalidComputer (2351)
- The computer name is invalid.
Sample
This sample code prompts the user to enter a parameter number and a value at the prompt. This value is then put into a buffer for use by the function.
#define INCL_SPL
#define INCL_SPLDOSPRINT
#define INCL_SPLERRORS
#include <os2.h>
#include <stdio.h> /* for printf function */
#include <stdlib.h> /* for atoi function */
#include <string.h> /* for strlen function */
INT main (argc, argv)
INT argc;
CHAR *argv[];
{
CHAR bufValue[2] = {0};
CHAR bufInput[128]= {0};
ULONG splerr ;
ULONG cbBuf ;
ULONG ulParmNum ;
USHORT usParm ;
PSZ pszComputerName ;
PSZ pszQueueName ;
PVOID pBuf;
if (argc != 2)
{
printf("Syntax: setqryq QueueName \n");
DosExit( EXIT_PROCESS , 0 ) ;
}
/* This function will be for the local workstation.
pszComputerName = (PSZ)NULL ;
/* Get the parameter from the command line. */
pszQueueName = argv[1];
/* Prompt the user for the parameter and values, and put them in buffers. */
printf("Enter Parameter number to be modified\n");
gets(&bufValue[0]);
printf("Enter new parameter value \n");
gets(&bufInput[0]);
/* Convert the ParmNum to a ULONG. */
ulParmNum = atoi(&bufValue[0]);
switch (ulParmNum){
case 2:
case 3:
case 4:
case 10:
/* Determine the size of the buffer needed. */
cbBuf = sizeof(PUSHORT);
/* Convert the buffer input to a USHORT. */
usParm =(USHORT)atoi(&bufInput[0]);
/* Set the pBuf pointer to point to the value obtained. */
pBuf = &usParm;
break;
case 5:
case 6:
case 8:
case 9:
case 12:
case 13:
/* Determine the size of the buffer needed. */
cbBuf = strlen(&bufInput[0])+1;
/* Set the pBuf pointer to point to the value obtained from input. */
pBuf = (PSZ)&bufInput;
break;
case 14:
printf("For simplicity this is not implemented.");
break;
default:
printf("Invalid number\n");
DosExit( EXIT_PROCESS , 0 ) ;
break;
}
/* Make the call with all the proper parameters. */
splerr = SplSetQueue(pszComputerName, pszQueueName, 3L,
pBuf, cbBuf, ulParmNum) ;
/* Print the resultant error code, and the parameters entered. */
printf("SplSetQueue Error= %ld, Parameter= %d, cbBuf= %ld,
ulParmNum= %ld\n",
splerr, usParm, cbBuf, ulParmNum);
DosExit( EXIT_PROCESS , 0 ) ;
return (splerr);
}
Call Sequence
#define INCL_SPL /* Or use INCL_PM, */ #include <os2.h> PSZ pszComputerName; /* Name of computer where queue is to be modified. */ PSZ pszQueueName; /* Queue name. */ ULONG ulLevel; /* Level of detail required. */ PVOID pBuf; /* Buffer. */ ULONG cbBuf; /* Size, in bytes, of Buffer. */ ULONG ulParmNum; /* Parameter number. */ SPLERR rc; /* Return code. */ rc = SplSetQueue(pszComputerName, pszQueueName, ulLevel, pBuf, cbBuf, ulParmNum);
Remarks
If the uPriority field in PRQINFO3 or PRQINFO6 is set to PRQ_NO_PRIORITY, the queue priority is not changed.