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) ;
}