IModelObject::GetContext method (dbgmodel.h)

Metode GetContext mengembalikan konteks host yang terkait dengan objek . Ini mewakili target, proses, utas, dll... objek berasal.

Sintaks

HRESULT GetContext(
  IDebugHostContext **context
);

Parameter

context

Konteks host objek akan dikembalikan dalam argumen ini.

Nilai kembali

Metode ini mengembalikan HRESULT yang menunjukkan keberhasilan atau kegagalan.

Keterangan

Sampel Kode

ComPtr<IDebugHost> spHost;      // get the debug host
ComPtr<IModelObject> spObject;  // get an object within a process (or a process object)

ComPtr<IDebugHostContext> spContext;
ComPtr<IDebugHostMemory> spMemory;
if (SUCCEEDED(spObject->GetContext(&spContext)) &&
    SUCCEEDED(spHost.As(&spMemory)))
{
    // Read 4 bytes from address 0x100 in the process context represented by spObject
    char bytes[4];
    ULONG64 bytesRead;
    HRESULT hr = spMemory->ReadBytes(spContext.Get(), 0x100, bytes, ARRAYSIZE(bytes), &bytesRead);
    
    // Check / Use read.
}

Persyaratan

Persyaratan Nilai
Header dbgmodel.h

Lihat juga

Antarmuka IModelObject