SplDeleteJob: Difference between revisions
No edit summary |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This function deletes a job from a print queue. | This function deletes a job from a print queue. | ||
== Syntax == | == Syntax == | ||
SplDeleteJob(pszComputerName, pszQueueName, ulJob) | SplDeleteJob(pszComputerName, pszQueueName, ulJob) | ||
== Parameters == | == Parameters == | ||
;pszComputerName (PSZ) - input | ;''pszComputerName'' ([[PSZ]]) - input:Name of computer where job is to be deleted. | ||
:Name of computer where job is to be deleted. | :A NULL string specifies the local workstation. | ||
;''pszQueueName'' ([[PSZ]]) - input:Queue Name. | |||
;''ulJob'' ([[ULONG]]) - input:Job identification number. | |||
: | == 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_JobNotFound (2151):The print job does not exist. | |||
:;NERR_ProcNoRespond (2160):The queue processor is not responding. | |||
:;NERR_SpoolerNotLoaded (2161):The spooler is not running. | |||
:;NERR_InvalidComputer (2351):The computer name is invalid. | |||
== Remarks == | |||
It is possible to delete a job that is currently printing. | |||
If the print queue on which the print job is submitted is pending deletion (following a [[SplDeleteQueue]] call), and the print job is the last in the queue, this function has the additional effect of deleting the queue. | |||
A user with administrator privilege can delete any job. | |||
A job created locally can be deleted locally regardless of user privilege level, but can be deleted remotely only by an administrator. | |||
A remote job can be deleted by a user without administrator privilege only if the username of the person initiating the request is the same as the username of the person who created the job. | |||
== Sample == | == Sample == | ||
This sample code will delete the job id that is entered at the prompt. | This sample code will delete the job id that is entered at the prompt. | ||
<pre> | <pre> | ||
#define INCL_BASE | #define INCL_BASE | ||
Line 98: | Line 92: | ||
SPLERR rc; /* Return code. */ | SPLERR rc; /* Return code. */ | ||
rc = SplDeleteJob(pszComputerName, pszQueueName, | rc = SplDeleteJob(pszComputerName, pszQueueName, ulJob); | ||
</pre> | </pre> | ||
== Related Functions == | == Related Functions == |
Latest revision as of 04:43, 3 September 2025
This function deletes a job from a print queue.
Syntax
SplDeleteJob(pszComputerName, pszQueueName, ulJob)
Parameters
- pszComputerName (PSZ) - input
- Name of computer where job is to be deleted.
- A NULL string specifies the local workstation.
- pszQueueName (PSZ) - input
- Queue Name.
- ulJob (ULONG) - input
- Job identification number.
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_JobNotFound (2151)
- The print job does not exist.
- NERR_ProcNoRespond (2160)
- The queue processor is not responding.
- NERR_SpoolerNotLoaded (2161)
- The spooler is not running.
- NERR_InvalidComputer (2351)
- The computer name is invalid.
Remarks
It is possible to delete a job that is currently printing.
If the print queue on which the print job is submitted is pending deletion (following a SplDeleteQueue call), and the print job is the last in the queue, this function has the additional effect of deleting the queue.
A user with administrator privilege can delete any job.
A job created locally can be deleted locally regardless of user privilege level, but can be deleted remotely only by an administrator.
A remote job can be deleted by a user without administrator privilege only if the username of the person initiating the request is the same as the username of the person who created the job.
Sample
This sample code will delete the job id that is entered at the prompt.
#define INCL_BASE #define INCL_SPL #define INCL_SPLERRORS #include <os2.h> #include <stdio.h> /* for printf function */ #include <stdlib.h> /* for atoi function */ INT main (argc, argv) INT argc; CHAR *argv[]; { SPLERR splerr ; ULONG ulJob ; PSZ pszComputerName = NULL ; PSZ pszQueueName = NULL ; /* Get job id from the input argument. */ ulJob = atoi(argv[1]); /* Call the function to do the delete. If an error is */ /* returned, print it. */ splerr = SplDeleteJob( pszComputerName, pszQueueName, ulJob); if (splerr != NO_ERROR) { switch (splerr) { case NERR_JobNotFound : printf("Job does not exist.\n"); break; case NERR_JobInvalidState: printf("This operation can't be performed on the print job.\n"); break; default: printf("Errorcode = %ld\n",splerr); } /* endswitch */ } else { printf("Job %d was deleted.\n",ulJob); } /* 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 job is to be deleted. */ PSZ pszQueueName; /* Queue Name. */ ULONG ulJob; /* Job identification number. */ SPLERR rc; /* Return code. */ rc = SplDeleteJob(pszComputerName, pszQueueName, ulJob);