共用方式為


IDebugProgram2::Attach

Attaches to the program.

HRESULT Attach( 
   IDebugEventCallback2* pCallback
);
int Attach( 
   IDebugEventCallback2 pCallback
);

Parameters

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 IDebugProgramNodeAttach2::OnAttach method is called. If the DE runs in the session debug manager's (SDM) address space, the IDebugEngine2::Attach method is called.

See Also

Reference

IDebugProgram2

IDebugEventCallback2

IDebugProgramNodeAttach2::OnAttach

IDebugEngine2::Attach