GetCurrentPrinterName
Collapse the table of content
Expand the table of content

IPrintDialogServices::GetCurrentPrinterName method

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

Syntax


HRESULT GetCurrentPrinterName(
   LPTSTR lpPrinterName,
   UINT   *pcchSize
);

Parameters

lpPrinterName

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

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Commdlg.h (include Windows.h)

DLL

Comdlg32.dll

See also

IPrintDialogServices
Reference
PrintDlgEx
Conceptual
Common Dialog Box Library

 

 

Community Additions

ADD
Show:
© 2016 Microsoft