Jump to content

SplPurgeQueue: Difference between revisions

From EDM2
Created page with "This function removes all jobs, except any currently printing, from a print queue. ==Syntax== SplPurgeQueue(pszComputerName, pszQueueName); ==Parameters== ;pszComputerName (..."
 
Ak120 (talk | contribs)
mNo edit summary
 
Line 1: Line 1:
This function removes all jobs, except any currently printing, from a print queue.  
This function removes all jobs, except any currently printing, from a print queue.
 
==Syntax==
==Syntax==
  SplPurgeQueue(pszComputerName, pszQueueName);
  SplPurgeQueue(pszComputerName, pszQueueName)
 
==Parameters==
==Parameters==
;pszComputerName (PSZ) - input  
;pszComputerName (PSZ) - input:Name of computer where queue is to be purged.
:Name of computer where queue is to be purged.  
:A NULL string specifies the local workstation.
 
;pszQueueName (PSZ) - input:Queue name.
:A NULL string specifies the local workstation.  
 
;pszQueueName (PSZ) - input  
:Queue name.  


==Return Code==
==Return Code==
;rc (SPLERR) - returns  
;rc (SPLERR) - returns:Return code.
:Return code.  


:;NO_ERROR (0)  
:NO_ERROR (0) : No errors occurred.
::No errors occurred.  
:ERROR_ACCESS_DENIED (5) : Access is denied.
:;ERROR_ACCESS_DENIED (5)  
:ERROR_NOT_SUPPORTED (50) : This request is not supported by the network.
::Access is denied.  
:ERROR_BAD_NETPATH (53) : The network path cannot be located.
:;ERROR_NOT_SUPPORTED (50)  
:ERROR_INVALID_PARAMETER (87) : An invalid parameter was specified.
::This request is not supported by the network.  
:NERR_NetNotStarted (2102) : The network program is not started.
:;ERROR_BAD_NETPATH (53)  
:NERR_QNotFound (2150) : The printer queue does not exist.
::The network path cannot be located.  
:NERR_SpoolerNotLoaded (2161) : The spooler is not running.
:;ERROR_INVALID_PARAMETER (87)  
:NERR_InvalidComputer (2351) : The computer name is invalid.
::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==
==Calling Sequence==
Line 44: Line 32:


rc = SplPurgeQueue(pszComputerName, pszQueueName);
rc = SplPurgeQueue(pszComputerName, pszQueueName);
</PRE>
</PRE>


Line 91: Line 77:
   return (splerr);
   return (splerr);
}
}
</PRE>
</PRE>


==Remarks==
==Remarks==
A print job that is printing is not affected by this function.  
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.  
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.


To purge a remote queue requires administrator privilege on the remote server.
==Related Functions==
==Related Functions==
*[[SplCreateQueue]]  
*[[SplCreateQueue]]
*[[SplEnumQueue]]
*[[SplEnumQueue]]
*[[SplQueryQueue]]
*[[SplQueryQueue]]


[[Category:Spl]]
[[Category:Spl]]

Latest revision as of 19:59, 2 July 2023

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.

Related Functions