共用方式為


IDebugCodeContext3::GetProcess

擷取偵錯進程的介面參考。

語法

public int GetProcess(
    out IDebugProcess2 ppProcess
);

參數

ppProcess
[out]偵錯進程介面的參考。

傳回值

如果成功,則會傳回 S_OK;否則,會傳回錯誤碼。

範例

下列範例示範如何針對公開 IDebugBeforeSymbolSearchEvent2 介面的 CDebugCodeContext 物件實作這個方法。

HRESULT CDebugCodeContext::GetProcess(IDebugProcess2** ppProcess)
{
    HRESULT hr = S_OK;
    CComPtr<CDebugEngine> pEngine;
    CComPtr<IDebugPort2> pPort2;

    IfFalseGo( ppProcess, E_INVALIDARG );
    *ppProcess = NULL;

    IfFalseGo( m_pProgram, E_FAIL );
    IfFailGo( ((CDebugProgram *)m_pProgram)->GetEngine(&pEngine) );
    IfFailGo( pEngine->GetSDMProcess(ppProcess) );

Error:

    return hr;
}

另請參閱