Windows Dev Center

IPrintDialogServices::GetCurrentPortName method

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

Syntax


HRESULT GetCurrentPortName(
   LPTSTR lpPortName,
   UINT   *pcchSize
);

Parameters

lpPortName

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

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:
© 2015 Microsoft