Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

DeletePrinterKey function

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

Syntax

DWORD DeletePrinterKey(
 _In_ HANDLE hPrinter,
 _In_ LPCTSTR pKeyName
);

Parameters

hPrinter [in]

A handle to the printer for which the function deletes a key. Use the OpenPrinter or AddPrinter function to retrieve a printer handle.

pKeyName [in]

A 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 value

If the function succeeds, the return value is ERROR_SUCCESS.

If the function fails, the return value is a system error code.

Remarks

Note

This is a blocking or synchronous function and might not return immediately. How quickly this function returns depends on run-time factors such as network status, print server configuration, and printer driver implementation factors that are difficult to predict when writing an application. Calling this function from a thread that manages interaction with the user interface could make the application appear to be unresponsive.

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Winspool.h (include Windows.h)
Library
Winspool.lib
DLL
Winspool.drv
Unicode and ANSI names
DeletePrinterKeyW (Unicode) and DeletePrinterKeyA (ANSI)

See also

Printing

Print Spooler API Functions

DeletePrinterDataEx

EnumPrinterDataEx

EnumPrinterKey

GetPrinterDataEx

OpenPrinter

SetPrinterDataEx


Feedback

Was this page helpful?

Additional resources