IDebugProgram2::Attach
Applies to: Visual Studio Visual 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 program.
Syntax
HRESULT Attach(
IDebugEventCallback2* pCallback
);
int Attach(
IDebugEventCallback2 pCallback
);
Parameters
pCallback
[in] An IDebugEventCallback2 object to be used for debug event notification.
Return Value
If successful, returns S_OK
; otherwise, returns an error code. The following table shows some possible error codes.
Value | Description |
---|---|
E_ATTACH_DEBUGGER_ALREADY_ATTACHED |
The specified program is already attached to the debugger. |
E_ATTACH_DEBUGGEE_PROCESS_SECURITY_VIOLATION |
A security violation occurred during the attach procedure. |
E_ATTACH_CANNOT_ATTACH_TO_DESKTOP |
A desktop program cannot be attached to the debugger. |
Remarks
A debug engine (DE) never calls this method to attach to a program. If the DE runs in the program's address space, the OnAttach method is called. If the DE runs in the session debug manager's (SDM) address space, the Attach method is called.