共用方式為


ICLRRuntimeHost

更新:2007 年 11 月

提供 .NET Framework 第 1 版中所提供之 ICorRuntimeHost 介面的相似功能,但具有下列變更:

  • 加入 SetHostControl 方法以設定主控制項介面。

  • 刪除 ICorRuntimeHost 提供的一些方法。

interface ICLRRuntimeHost : IUnknown {
        
    HRESULT ExecuteApplication (
        [in] LPCWSTR                   pwzAppFullName,
        [in] DWORD                     dwManifestPaths,
        [in] LPCWSTR                   *ppwzManifestPaths,   
        [in] DWORD                     dwActivationData,
        [in] LPCWSTR                   *ppwzActivationData,  
        [out] int                      *pReturnValue
    );
        
    HRESULT ExecuteInAppDomain (
        [in] DWORD                     appDomainId, 
        [in] FExecuteInDomainCallback  pCallback,
        [in] void*                     cookie
    );
        
    HRESULT ExecuteInDefaultAppDomain (
        [in] LPCWSTR                   pwzAssemblyPath, 
        [in] LPCWSTR                   pwzTypeName,
        [in] LPCWSTR                   pwzMethodName,
        [in] LPCWSTR                   pwzArgument,
        [out] DWORD                    *pReturnValue
    );
        
    HRESULT GetCLRControl (
        [out] ICLRControl              **pCLRControl
    );
        
    HRESULT GetCurrentAppDomainId (
        [out] DWORD                    *pdwAppDomainId
    );
        
    HRESULT SetHostControl (
        [in] IHostControl              *pHostControl
    );
        
    HRESULT Start();
        
    HRESULT Stop();
        
    HRESULT UnloadAppDomain (
        [in] DWORD                     dwAppDomainId
        [in] BOOL                      fWaitUntilDone
    );
        
};

方法

方法

描述

ICLRRuntimeHost::ExecuteApplication 方法

用於以資訊清單為基礎的 ClickOnce 部署案例中,指定要在新定義域中啟動的應用程式。

ICLRRuntimeHost::ExecuteInAppDomain 方法

指定 AppDomain 將執行指定的 Managed 程式碼。

ICLRRuntimeHost::ExecuteInDefaultAppDomain 方法

在指定的組件中叫用指定型別的指定方法。

ICLRRuntimeHost::GetCLRControl 方法

取得 ICLRControl 型別的介面指標,主應用程式可使用此型別來自訂 Common Language Runtime (CLR) 的各個層面。

ICLRRuntimeHost::GetCurrentAppDomainId 方法

取得目前正在執行之 AppDomain 的數值識別碼。

ICLRRuntimeHost::SetHostControl 方法

設定主控制項介面。您必須先呼叫 SetHostControl,然後再呼叫 Start

ICLRRuntimeHost::Start 方法

將 CLR 初始化至處理序中。

ICLRRuntimeHost::Stop 方法

停止執行階段的程式碼執行。

ICLRRuntimeHost::UnloadAppDomain 方法

卸載與指定的數字識別項相對應的 AppDomain

備註

主應用程式會藉由呼叫 CorBindToRuntimeExCorBindToCurrentRuntime,取得 ICLRRuntimeHost 執行個體的指標。若要提供 .NET Framework 2.0 版中所提供的任何技術實作,您必須使用 ICLRRuntimeHost 來替代 ICorRuntimeHost

重要事項:

呼叫 ExecuteApplication 方法以啟動資訊清單架構應用程式之前,請勿呼叫 Start 方法。如果先呼叫 Start 方法,ExecuteApplication 方法呼叫將會失敗。

需求

**平台:**請參閱 .NET Framework 系統需求

**標頭:**MSCorEE.idl

程式庫:包含做為 MSCorEE.dll 中的資源

**.NET Framework 版本:**3.5 SP1、3.5、3.0 SP1、3.0、2.0 SP1、2.0

請參閱

參考

CorBindToCurrentRuntime 函式

CorBindToRuntimeEx 函式

ICLRControl

ICorRuntimeHost

其他資源

裝載 Common Language Runtime

裝載介面