IPrintDialogServices::GetCurrentPrinterName

[This is preliminary documentation and subject to change.]

An application using the PrintDlgEx function can call the GetCurrentPrinterName method to retrieve the name of the currently selected printer.

HRESULT GetCurrentPrinterName(
  LPTSTR lpPrinterName,
  UINT *pcchSize
);
 

Parameters

lpPrinterName
Pointer to a buffer that receives the null-terminated name of the currently selected printer.
pcchSize
Pointer to a UINT variable. On input, the variable specifies the size, in bytes (ANSI version) or 16-bit characters (Unicode version), of the buffer pointed to by the lpPrinterName parameter. On output, the variable contains the number of bytes or characters, 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 Values

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.

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in commdlg.h.

See Also

Common Dialog Box Library Overview, IPrintDialogServices, PrintDlgEx