Jump to content

SplReleaseQueue

From EDM2
Revision as of 20:25, 2 July 2023 by Ak120 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function releases a held print queue.

Syntax

SplReleaseQueue(pszComputerName, pszQueueName)

Parameters

pszComputerName (PSZ) - input
Name of computer where queue is to be continued.
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.
NERR_NetNotStarted (2102) :The network program is not started.
NERR_QNotFound (2150) :The printer queue does not exist.
NERR_InvalidComputer (2351) :The computer name is invalid.

Sample

This sample code will release the local queue 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 release. If an error is returned, print it. */
   splerr=SplReleaseQueue(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 released.\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 continued. */
PSZ       pszQueueName;     /*  Queue name. */
SPLERR    rc;               /*  Return code. */

rc = SplReleaseQueue(pszComputerName, pszQueueName);

Remarks

This function releases a queue that has been held by a SplHoldQueue function, or disabled by an error on the queue. It does not affect an active print queue.

To release a queue on a remote server requires administrator privilege on the remote server.

Related Functions