SplCreateQueue: Difference between revisions
mNo edit summary |
|||
Line 1: | Line 1: | ||
This function creates a new print queue on the local workstation or on a remote server. A remote server setup requires the LAN Requester and Server software. | This function creates a new print queue on the local workstation or on a remote server. A remote server setup requires the LAN Requester and Server software. | ||
== Syntax == | == Syntax == | ||
SplCreateQueue(pszComputerName, ulLevel, pbBuf, cbBuf) | |||
== Parameters == | == Parameters == | ||
;pszComputerName (PSZ) - input | ;pszComputerName (PSZ) - input:Name of computer where queue is to be created. | ||
:Name of computer where queue is to be created. | :A NULL string specifies a local workstation. | ||
;ulLevel (ULONG) - input:Level of detail provided. | |||
:A NULL string specifies a local workstation. | :This must be 3 or 6. | ||
;pbBuf (PVOID) - input:Data structure. | |||
;ulLevel (ULONG) - input | :It points to a data structure depending on the value specified in ulLevel as follows: | ||
:Level of detail provided. | :ulLevel Buffer Content. | ||
:3 a PRQINFO3 data structure | |||
:This must be 3 or 6. | :6 a PRQINFO6 data structure | ||
;cbBuf (ULONG) - input:Size, in bytes, of data structure. | |||
;pbBuf (PVOID) - input | :It must be greater than 0. | ||
:Data structure. | |||
:It points to a data structure depending on the value specified in ulLevel as follows: | |||
:ulLevel Buffer Content. | |||
:3 a PRQINFO3 data structure | |||
:6 a PRQINFO6 data structure | |||
;cbBuf (ULONG) - input | |||
:Size, in bytes, of data structure. | |||
:It must be greater than 0. | |||
== Returns == | == Returns == | ||
;rc (SPLERR) - returns | ;rc (SPLERR) - returns | ||
:Return code. | :Return code. | ||
;NO_ERROR (0) | ;NO_ERROR (0):No errors occurred. | ||
:No errors occurred. | ;ERROR_NOT_SUPPORTED (50):This request is not supported by the network. | ||
;ERROR_NOT_SUPPORTED (50) | ;ERROR_INVALID_PARAMETER (87):An invalid parameter is specified. | ||
:This request is not supported by the network. | ;ERROR_INVALID_NAME (123):The computer name is invalid. | ||
;ERROR_INVALID_PARAMETER (87) | ;ERROR_INVALID_LEVEL (124):The level parameter is invalid. | ||
:An invalid parameter is specified. | ;NERR_NetNotStarted (2102):The network program is not started. | ||
;ERROR_INVALID_NAME (123) | ;NERR_RedirectedPath (2117):The operation is invalid on a redirected resource. | ||
:The computer name is invalid. | ;NERR_BufTooSmall (2123):The API return buffer is too small. | ||
;ERROR_INVALID_LEVEL (124) | ;NERR_DestNotFound (2152):The printer destination cannot be found. | ||
:The level parameter is invalid. | ;NERR_QExists (2154):The printer queue already exists. | ||
;NERR_NetNotStarted (2102) | ;NERR_DestInvalidState (2162):This operation cannot be performed on the print destination in its current state. | ||
:The network program is not started. | ;NERR_SpoolNoMemory (2165):A spooler memory allocation failure occurred. | ||
;NERR_RedirectedPath (2117) | ;NERR_DriverNotFound (2166):The device driver does not exist. | ||
:The operation is invalid on a redirected resource. | ;NERR_DataTypeInvalid (2167):The data type is not supported by the queue processor. | ||
;NERR_BufTooSmall (2123) | ;NERR_ProcNotFound (2168):The queue processor is not installed. | ||
:The API return buffer is too small. | ;NERR_BadDev (2341):The requested device is invalid. | ||
;NERR_DestNotFound (2152) | ;NERR_CommDevInUse (2343):This device is already in use as a communications device. | ||
:The printer destination cannot be found. | ;NERR_InvalidComputer (2351):The computer name is invalid. | ||
;NERR_QExists (2154) | |||
:The printer queue already exists. | |||
;NERR_DestInvalidState (2162) | |||
:This operation cannot be performed on the print destination in its current state. | |||
;NERR_SpoolNoMemory (2165) | |||
:A spooler memory allocation failure occurred. | |||
;NERR_DriverNotFound (2166) | |||
:The device driver does not exist. | |||
;NERR_DataTypeInvalid (2167) | |||
:The data type is not supported by the queue processor. | |||
;NERR_ProcNotFound (2168) | |||
:The queue processor is not installed. | |||
;NERR_BadDev (2341) | |||
:The requested device is invalid. | |||
;NERR_CommDevInUse (2343) | |||
:This device is already in use as a communications device. | |||
;NERR_InvalidComputer (2351) | |||
:The computer name is invalid. | |||
== Sample == | == Sample == | ||
This sample code creates a queue on the local workstation. The queue is created with dummy parameters. The name is entered at the command line. | This sample code creates a queue on the local workstation. The queue is created with dummy parameters. The name is entered at the command line. | ||
<pre> | <pre> | ||
#define INCL_BASE | #define INCL_BASE | ||
Line 81: | Line 51: | ||
#include <string.h> | #include <string.h> | ||
INT main (argc, argv ) | INT main (argc, argv) | ||
INT argc; | INT argc; | ||
CHAR *argv[]; | CHAR *argv[]; | ||
{ | { | ||
ULONG splerr | ULONG splerr; | ||
ULONG cbBuf; | ULONG cbBuf; | ||
ULONG ulLevel ; | ULONG ulLevel; | ||
PSZ pszComputerName ; | PSZ pszComputerName; | ||
PSZ pszQueueName ; | PSZ pszQueueName; | ||
PRQINFO3 prq3 | PRQINFO3 prq3; | ||
if (argc != 2) | if (argc != 2) | ||
Line 146: | Line 116: | ||
rc = SplCreateQueue(pszComputerName, ulLevel, pbBuf, cbBuf); | rc = SplCreateQueue(pszComputerName, ulLevel, pbBuf, cbBuf); | ||
</pre> | </pre> | ||
== Remarks == | == Remarks == | ||
To create a queue on a remote server requires administrator privilege. The following fields are required in PRQINFO3 or PRQINFO6: | To create a queue on a remote server requires administrator privilege. The following fields are required in PRQINFO3 or PRQINFO6: | ||
*uPriority | *uPriority | ||
*uStartTime | *uStartTime | ||
*uUntilTime | *uUntilTime | ||
*pszSepFile | *pszSepFile | ||
*pszParms | *pszParms | ||
If a queue of the name specified in pszName already exists on pszComputerName, the call fails unless the queue is marked for deletion. In this case, the queue is not deleted, and the creation fields are used to perform a SplSetQueue function on the queue. | |||
If | If pszPrinters is NULL, the queue is created but not connected to any printer. | ||
pszDriverName can be a NULL string, in which case pDriverData. is ignored. Otherwise, pszDriverName must refer to the name of a device driver that is already defined in the initialization file (for example, "IBM4019"). | |||
pszDriverName can be a NULL string, in which case pDriverData. is ignored. Otherwise, pszDriverName must refer to the name of a device driver that is already defined in the initialization file (for example, "IBM4019"). | |||
== Related Functions == | == Related Functions == | ||
Line 166: | Line 134: | ||
* [[SplEnumDevice]] | * [[SplEnumDevice]] | ||
* [[SplEnumDriver]] | * [[SplEnumDriver]] | ||
* [[SplEnumQueueProcessor]] | * [[SplEnumQueueProcessor]] | ||
[[Category:spl]] | [[Category:spl]] |
Latest revision as of 12:39, 2 July 2023
This function creates a new print queue on the local workstation or on a remote server. A remote server setup requires the LAN Requester and Server software.
Syntax
SplCreateQueue(pszComputerName, ulLevel, pbBuf, cbBuf)
Parameters
- pszComputerName (PSZ) - input
- Name of computer where queue is to be created.
- A NULL string specifies a local workstation.
- ulLevel (ULONG) - input
- Level of detail provided.
- This must be 3 or 6.
- pbBuf (PVOID) - input
- Data structure.
- It points to a data structure depending on the value specified in ulLevel as follows:
- ulLevel Buffer Content.
- 3 a PRQINFO3 data structure
- 6 a PRQINFO6 data structure
- cbBuf (ULONG) - input
- Size, in bytes, of data structure.
- It must be greater than 0.
Returns
- rc (SPLERR) - returns
- Return code.
- NO_ERROR (0)
- No errors occurred.
- ERROR_NOT_SUPPORTED (50)
- This request is not supported by the network.
- ERROR_INVALID_PARAMETER (87)
- An invalid parameter is specified.
- ERROR_INVALID_NAME (123)
- The computer name is invalid.
- ERROR_INVALID_LEVEL (124)
- The level parameter is invalid.
- NERR_NetNotStarted (2102)
- The network program is not started.
- NERR_RedirectedPath (2117)
- The operation is invalid on a redirected resource.
- NERR_BufTooSmall (2123)
- The API return buffer is too small.
- NERR_DestNotFound (2152)
- The printer destination cannot be found.
- NERR_QExists (2154)
- The printer queue already exists.
- NERR_DestInvalidState (2162)
- This operation cannot be performed on the print destination in its current state.
- NERR_SpoolNoMemory (2165)
- A spooler memory allocation failure occurred.
- NERR_DriverNotFound (2166)
- The device driver does not exist.
- NERR_DataTypeInvalid (2167)
- The data type is not supported by the queue processor.
- NERR_ProcNotFound (2168)
- The queue processor is not installed.
- NERR_BadDev (2341)
- The requested device is invalid.
- NERR_CommDevInUse (2343)
- This device is already in use as a communications device.
- NERR_InvalidComputer (2351)
- The computer name is invalid.
Sample
This sample code creates a queue on the local workstation. The queue is created with dummy parameters. The name is entered at the command line.
#define INCL_BASE #define INCL_SPL #define INCL_SPLDOSPRINT #include <os2.h> #include <stdio.h> #include <string.h> INT main (argc, argv) INT argc; CHAR *argv[]; { ULONG splerr; ULONG cbBuf; ULONG ulLevel; PSZ pszComputerName; PSZ pszQueueName; PRQINFO3 prq3; if (argc != 2) { printf("Syntax: sqcrt QueueName \n"); DosExit( EXIT_PROCESS , 0 ) ; } pszComputerName = (PSZ)NULL ; ulLevel = 3L; /* Get the queue name from the argument entered at */ /* the command line. */ pszQueueName = argv[1]; /* Determine the size of the needed buffer. */ cbBuf = sizeof(PRQINFO3); /* Set up the structure with some dummy parameters. */ prq3.pszName = pszQueueName; prq3.uPriority=5; prq3.uStartTime=0; prq3.uUntilTime=0; prq3.pszSepFile="c:\\os2\\sample.sep"; prq3.pszParms=NULL; prq3.pszPrinters=NULL; prq3.pszDriverName=NULL; prq3.pDriverData="IBMNULL"; /* Set to Driver.Device name */ /* Make the call with the proper parameters. */ splerr = SplCreateQueue(pszComputerName, ulLevel, &prq3, cbBuf); /* Print out the error return code and some other information. */ printf("SplCreateQueue Error=%ld, cbNeeded=%ld\n", splerr, cbBuf) ; 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 created. */ ULONG ulLevel; /* Level of detail provided. */ PVOID pbBuf; /* Data structure. */ ULONG cbBuf; /* Size, in bytes, of data structure. */ SPLERR rc; /* Return code. */ rc = SplCreateQueue(pszComputerName, ulLevel, pbBuf, cbBuf);
Remarks
To create a queue on a remote server requires administrator privilege. The following fields are required in PRQINFO3 or PRQINFO6:
- uPriority
- uStartTime
- uUntilTime
- pszSepFile
- pszParms
If a queue of the name specified in pszName already exists on pszComputerName, the call fails unless the queue is marked for deletion. In this case, the queue is not deleted, and the creation fields are used to perform a SplSetQueue function on the queue.
If pszPrinters is NULL, the queue is created but not connected to any printer.
pszDriverName can be a NULL string, in which case pDriverData. is ignored. Otherwise, pszDriverName must refer to the name of a device driver that is already defined in the initialization file (for example, "IBM4019").