SplPurgeQueue
Appearance
This function removes all jobs, except any currently printing, from a print queue.
Syntax
SplPurgeQueue(pszComputerName, pszQueueName)
Parameters
- pszComputerName (PSZ) - input
- Name of computer where queue is to be purged.
- A NULL string specifies the local workstation.
- pszQueueName (PSZ) - input
- Queue name.
Return Code
- 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 was specified.
- NERR_NetNotStarted (2102) : The network program is not started.
- NERR_QNotFound (2150) : The printer queue does not exist.
- NERR_SpoolerNotLoaded (2161) : The spooler is not running.
- NERR_InvalidComputer (2351) : The computer name is invalid.
Calling Sequence
#define INCL_SPL /* Or use INCL_PM, */ #include <os2.h> PSZ pszComputerName; /* Name of computer where queue is to be purged. */ PSZ pszQueueName; /* Queue name. */ SPLERR rc; /* Return code. */ rc = SplPurgeQueue(pszComputerName, pszQueueName);
Sample
This code will purge a local queue, whose name 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 *arg[];
{
SPLERR splerr ;
PSZ pszComputerName = NULL ;
PSZ pszQueueName ;
/* Get queue name from the input argument. */
pszQueueName = arg[1];
/* Call the function to do the purge. If an error is returned, print it. */
splerr=SplPurgeQueue(pszComputerName, pszQueueName);
if (splerr != 0L)
{
switch (splerr)
{
case NERR_QNotFound:
printf("Queue does not exist.\n");
break;
case NERR_SpoolerNotLoaded:
printf("The Spooler is not running.\n");
break;
default:
printf("Errorcode = %ld\n",splerr);
} /* endswitch */
}
else
{
printf("Queue %s was purged.\n",pszQueueName);
} /* endif */
DosExit( EXIT_PROCESS , 0 ) ;
return (splerr);
}
Remarks
A print job that is printing is not affected by this function.
If a print queue is pending deletion when this function is made, the queue is deleted when the job that is currently printing ends.
To purge a remote queue requires administrator privilege on the remote server.