共用方式為


IDebugPortSupplier2::AddPort

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Adds a port.

Syntax

HRESULT AddPort( 
   IDebugPortRequest2* pRequest,
   IDebugPort2**       ppPort
);
int AddPort( 
   IDebugPortRequest2 pRequest,
   out IDebugPort2    ppPort
);

Parameters

pRequest
[in] An IDebugPortRequest2 object that describes the port to be added.

ppPort
[out] Returns an IDebugPort2 object that represents the port.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Remarks

This method actually creates the requested port as well as adding it to the port supplier's internal list of active ports. The CanAddPort method can be called first to avoid possible time-consuming delays.

See also