SplDeleteQueue: Difference between revisions
Appearance
Created page with "This function deletes a print queue from the spooler. == Syntax == SplDeleteQueue(pszComputerName, pszQueueName); == Parameters == ;pszComputerName (PSZ) - input :Name o..." |
mNo edit summary |
||
Line 1: | Line 1: | ||
This function deletes a print queue from the spooler. | This function deletes a print queue from the spooler. | ||
== Syntax == | |||
SplDeleteQueue(pszComputerName, pszQueueName) | |||
== Parameters == | == Parameters == | ||
;pszComputerName (PSZ) - input | ;pszComputerName (PSZ) - input:Name of computer where queue is to be deleted. | ||
:Name of computer where queue is to be deleted. | :A NULL string specifies the local workstation. | ||
;pszQueueName (PSZ) - input:Queue name. | |||
: | == 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. | |||
:;NERR_NetNotStarted (2102):The network program is not started. | |||
:;NERR_QNotFound (2150):The printer queue does not exist. | |||
:;NERR_QInvalidState (2163):This operation cannot be performed on the print queue. | |||
:;NERR_InvalidComputer (2351):The computer name is invalid. | |||
== Sample == | == Sample == | ||
This sample code will delete the queue name that is entered at the prompt. | This sample code will delete the queue name that is entered at the prompt. | ||
<pre> | <pre> | ||
#define INCL_SPL | #define INCL_SPL | ||
Line 78: | Line 66: | ||
return (splerr); | return (splerr); | ||
} | } | ||
</pre> | </pre> | ||
Line 92: | Line 78: | ||
rc = SplDeleteQueue(pszComputerName, pszQueueName); | rc = SplDeleteQueue(pszComputerName, pszQueueName); | ||
</pre> | </pre> | ||
== Remarks == | == Remarks == | ||
If there are print jobs in the queue, SplDeleteQueue marks the queue PRQ3_PENDING. No further jobs can then be added to the queue, which is deleted when all jobs are printed. A queue marked PRQ3_PENDING can be held, and jobs in the queue can be held, restarted, and repeated. | If there are print jobs in the queue, SplDeleteQueue marks the queue PRQ3_PENDING. No further jobs can then be added to the queue, which is deleted when all jobs are printed. A queue marked PRQ3_PENDING can be held, and jobs in the queue can be held, restarted, and repeated. | ||
If a queue is held and there are jobs on the queue, a SplDeleteQueue function fails with NERR_QInvalidState (2163). | |||
To delete a queue on a remote server requires administrator privilege on the remote server. | |||
== Related Functions == | == Related Functions == | ||
* [[SplCreateQueue]] | * [[SplCreateQueue]] |
Latest revision as of 12:44, 2 July 2023
This function deletes a print queue from the spooler.
Syntax
SplDeleteQueue(pszComputerName, pszQueueName)
Parameters
- pszComputerName (PSZ) - input
- Name of computer where queue is to be deleted.
- A NULL string specifies the local workstation.
- pszQueueName (PSZ) - input
- Queue name.
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.
- NERR_NetNotStarted (2102)
- The network program is not started.
- NERR_QNotFound (2150)
- The printer queue does not exist.
- NERR_QInvalidState (2163)
- This operation cannot be performed on the print queue.
- NERR_InvalidComputer (2351)
- The computer name is invalid.
Sample
This sample code will delete the queue name that is entered at the prompt.
#define INCL_SPL #define INCL_SPLERRORS #include <os2.h> #include <stdio.h> /* for printf function */ INT main (argc, argv) INT argc; CHAR *argv[]; { SPLERR splerr ; PSZ pszComputerName = NULL ; PSZ pszQueueName ; /* Get queue name from the input argument */ pszQueueName = argv[1]; /* Call the function to do the delete. If an error is returned, print it. */ splerr=SplDeleteQueue(pszComputerName, pszQueueName); if (splerr != 0L) { switch (splerr) { case NERR_QNotFound : printf("Queue does not exist.\n"); break; case NERR_QInvalidState: printf("This operation can't be performed on the print queue.\n"); break; default: printf("Errorcode = %ld\n",splerr); } /* endswitch */ } else { printf("Queue %s was deleted.\n",pszQueueName); } /* endif */ 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 deleted. */ PSZ pszQueueName; /* Queue name. */ SPLERR rc; /* Return code. */ rc = SplDeleteQueue(pszComputerName, pszQueueName);
Remarks
If there are print jobs in the queue, SplDeleteQueue marks the queue PRQ3_PENDING. No further jobs can then be added to the queue, which is deleted when all jobs are printed. A queue marked PRQ3_PENDING can be held, and jobs in the queue can be held, restarted, and repeated.
If a queue is held and there are jobs on the queue, a SplDeleteQueue function fails with NERR_QInvalidState (2163).
To delete a queue on a remote server requires administrator privilege on the remote server.