共用方式為


IDebugProgramNodeAttach2::OnAttach

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

Attaches to the associated program or defers the attach process to the Attach method.

Syntax

HRESULT OnAttach(
   [in] REFGUID guidProgramId
);
int OnAttach(
   ref Guid guidProgramId
};

Parameters

guidProgramId
[in] GUID to assign to the associated program.

Return Value

If successful, returns S_OK. Returns S_FALSE if the Attach method should not be called. Otherwise, returns an error code.

Remarks

This method is called during the attach process, before the Attach method is called. The OnAttach method can perform the attach process itself (in which case, this method returns S_FALSE) or defer the attach process to the IDebugEngine2::Attach method (the OnAttach method returns S_OK). In either event, the OnAttach method can set the GUID of the program being debugged to the given GUID.

See also