IPrintDialogServices::GetCurrentPrinterName method (commdlg.h)

Retrieves the name of the currently selected printer, for use with PrintDlgEx.

Syntax

HRESULT GetCurrentPrinterName(
  LPWSTR pPrinterName,
  UINT   *pcchSize
);

Parameters

pPrinterName

Type: LPTSTR

The name of the currently selected printer.

pcchSize

Type: UINT*

On input, the variable specifies the size, in characters, of the buffer pointed to by the lpPrinterName parameter. On output, the variable contains the number of bytes (ANSI) or characters (Unicode), including the terminating null character, written to the buffer.

If the size is zero on input, the function returns the required buffer size (in bytes or characters) in pcchSize and does not use the lpPrinterName buffer.

Return value

Type: HRESULT

If the method is successful, the return value is S_OK. If no printer is currently selected, the return value is S_OK, the value returned in pcchSize is zero, and the lpPrinterName buffer is unchanged.

If an error occurs, the return value is a COM error code. For more information, see Error Handling.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header commdlg.h (include Windows.h)
DLL Comdlg32.dll

See also

Common Dialog Box Library

Conceptual

IPrintDialogServices

PrintDlgEx

Reference