SplDeleteQueue

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.
 * 1) define INCL_SPL
 * 2) define INCL_SPLERRORS
 * 3) include 
 * 4) include       /* 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

 * 1) define INCL_SPL /* Or use INCL_PM, */
 * 2) include 

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.

Related Functions

 * SplCreateQueue
 * SplEnumQueue
 * SplQueryQueue