SplDeleteDevice: Difference between revisions
Appearance
Created page with "This function deletes a print device. == Syntax == SplDeleteDevice(pszComputerName, pszPrintDeviceName); == Parameters == ;pszComputerName (PSZ) - input :Name of comput..." |
mNo edit summary |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
This function deletes a print device. | This function deletes a print device. | ||
== Syntax == | == Syntax == | ||
SplDeleteDevice(pszComputerName, pszPrintDeviceName) | |||
== Parameters == | == Parameters == | ||
;pszComputerName (PSZ) - input | ;pszComputerName (PSZ) - input:Name of computer where print device is. to be deleted. | ||
:Name of computer where print device is. to be deleted. | :A NULL string specifies the local workstation. | ||
;pszPrintDeviceName (PSZ) - input:Name of Print Device. | |||
:A NULL string specifies the local workstation. | |||
;pszPrintDeviceName (PSZ) - input | |||
:Name of Print Device. | |||
== Returns == | == Returns == | ||
;rc (SPLERR) - returns | ;rc (SPLERR) - returns:Return code. | ||
: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_DestNotFound (2152) : The print device cannot be found. | |||
: | ::NERR_DestInvalidState (2162) : This operation cannot be performed on the print device. | ||
::NERR_InvalidComputer (2351) : The computer name is invalid. | |||
: | |||
: | |||
: | |||
: | |||
: | |||
== Sample == | == Sample == | ||
This sample code will delete the print device whose name is entered at the prompt. | This sample code will delete the print device whose name is entered at the prompt. | ||
<pre> | <pre> | ||
#define INCL_BASE | #define INCL_BASE | ||
Line 102: | Line 88: | ||
rc = SplDeleteDevice(pszComputerName, pszPrintDeviceName); | rc = SplDeleteDevice(pszComputerName, pszPrintDeviceName); | ||
</pre> | </pre> | ||
== Remarks == | == Remarks == | ||
If the print device is currently printing a job, SplDeleteDevice fails and returns NERR_DestInvalidState (2162). | If the print device is currently printing a job, SplDeleteDevice fails and returns NERR_DestInvalidState (2162). | ||
To delete a print device on a remote server requires administrator privilege. | To delete a print device on a remote server requires administrator privilege. | ||
== Related Functions == | == Related Functions == | ||
* SplCreateDevice | * [[SplCreateDevice]] | ||
* SplEnumDevice | * [[SplEnumDevice]] | ||
[[Category: | [[Category:Spl]] |
Latest revision as of 22:30, 7 June 2020
This function deletes a print device.
Syntax
SplDeleteDevice(pszComputerName, pszPrintDeviceName)
Parameters
- pszComputerName (PSZ) - input
- Name of computer where print device is. to be deleted.
- A NULL string specifies the local workstation.
- pszPrintDeviceName (PSZ) - input
- Name of Print Device.
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_DestNotFound (2152) : The print device cannot be found.
- NERR_DestInvalidState (2162) : This operation cannot be performed on the print device.
- NERR_InvalidComputer (2351) : The computer name is invalid.
Sample
This sample code will delete the print device whose name is entered at the prompt.
#define INCL_BASE #define INCL_DOSMEMMGR #define INCL_SPL #define INCL_SPLDOSPRINT #define INCL_SPLERRORS #include <os2.h> #include <stdio.h> INT main (argc, argv) INT argc; CHAR *argv[]; { SPLERR splerr= 0L; PSZ pszComputerName ; PSZ pszPrintDeviceName ; /* Check that the parameters were entered at the command line. */ if (argc != 2) { printf("Syntax: sddel PrintDeviceName \n"); DosExit( EXIT_PROCESS , 0 ) ; } /* Computer name of NULL indicates the local computer. */ pszComputerName = (PSZ)NULL ; /* Set the PrintDeviceName to the value entered at the command line. */ pszPrintDeviceName = argv[1]; /* Make the call and print out the return code. */ splerr=SplDeleteDevice(pszComputerName, pszPrintDeviceName); switch (splerr) { case NO_ERROR: printf("Print Device %s was deleted.\n",pszPrintDeviceName); break; case NERR_DestNotFound : printf("Destination does not exist.\n"); break; case NERR_DestInvalidState: printf("This operation can't be performed on the print device.\n"); break; case NERR_SpoolerNotLoaded: printf("The Spooler is not running.\n"); break; default: printf("SplDeleteDevice Errorcode = %ld\n",splerr); } /* endswitch */ DosExit( EXIT_PROCESS , 0 ) ; return (splerr) ; }
Call Sequence
#define INCL_SPL /* Or use INCL_PM, */ #include <os2.h> PSZ pszComputerName; /* Name of computer where print device is. to be deleted. */ PSZ pszPrintDeviceName; /* Name of Print Device. */ SPLERR rc; /* Return code. */ rc = SplDeleteDevice(pszComputerName, pszPrintDeviceName);
Remarks
If the print device is currently printing a job, SplDeleteDevice fails and returns NERR_DestInvalidState (2162).
To delete a print device on a remote server requires administrator privilege.