DeletePrinterKey

[This is preliminary documentation and subject to change.]

The DeletePrinterKey function deletes a specified key and all its subkeys for a specified printer.

DWORD DeletePrinterKey(
  HANDLE hPrinter,       // handle to printer object
  LPCTSTR pKeyName       // name of the registry key to delete
);
 

Parameters

hPrinter
Handle to the printer for which the function deletes a key. Use the OpenPrinter function to retrieve a printer handle.
pKeyName
Pointer to a null-terminated string that specifies the key to delete. Use the backslash ( \ ) character as a delimiter to specify a path with one or more subkeys.

If pKeyName is an empty string (""), DeletePrinterKey deletes all keys below the top-level key for the printer. If pKeyName is NULL, DeletePrinterKey returns ERROR_INVALID_PARAMETER.

Return Values

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a Win32 error value.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winspool.h.
  Import Library: Use winspool.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Printing and Print Spooler Overview, Printing and Print Spooler Functions, DeletePrinterDataEx, EnumPrinterDataEx, EnumPrinterKey, GetPrinterDataEx, OpenPrinter, SetPrinterDataEx