IPrintDialogServices::GetCurrentPortName method (commdlg.h)

Retrieves the name of the current port for use with PrintDlgEx.

Syntax

HRESULT GetCurrentPortName(
  LPWSTR pPortName,
  UINT   *pcchSize
);

Parameters

pPortName

Type: LPTSTR

The name of the current port.

pcchSize

Type: UINT*

On input, the variable specifies the size, in characters, of the buffer pointed to by the lpPortName 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 lpPortName buffer.

Return value

Type: HRESULT

If the method is successful, the return value is S_OK. If there is no current port, the return value is S_OK, the value returned in pcchSize is zero, and the lpPortName 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