CLRCreateInstance Function
This page is specific to:.NET Framework Version:4.0
.NET Framework 4
CLRCreateInstance Function

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Provides one of three interfaces: ICLRMetaHost, ICLRMetaHostPolicy, or ICLRDebugging.

HRESULT CLRCreateInstance(
    [in]  REFCLSID  clsid,
    [in]  RFIID     riid,
    [out] LPVOID  * ppInterface
);
Parameters

clsid

[in] One of three class identifiers: CLSID_CLRMetaHost, CLSID_CLRMetaHostPolicy, or CLSID_CLRDebugging.

riid

[in] One of three interface identifiers (IIDs): IID_ICLRMetaHost, IID_ICLRMetaHostPolicy, or IID_ICLRDebugging.

ppInterface

[out] One of three interfaces: ICLRMetaHost, ICLRMetaHostPolicy, or ICLRDebugging.

Return Value

This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.

HRESULT

Description

S_OK

The method completed successfully.

E_POINTER

ppInterface is null.

Remarks

The following table shows the supported combinations for clsid and riid.

rclsid

riid

CLSID_CLRMetaHost

IID_ICLRMetaHost

CLSID_CLRMetaHostPolicy

IID_ICLRMetaHostPolicy

CLSID_CLRDebugging

IID_ICLRDebugging

The following code shows how to use CLRCreateInstance to get all three interfaces:

#include <metahost.h>
#pragma comment(lib, "mscoree.lib")

ICLRMetaHost       *pMetaHost       = NULL;
ICLRMetaHostPolicy *pMetaHostPolicy = NULL;
ICLRDebugging      *pCLRDebugging   = NULL;
HRESULT hr;
hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost,
                    (LPVOID*)&pMetaHost);
hr = CLRCreateInstance (CLSID_CLRMetaHostPolicy, IID_ICLRMetaHostPolicy,
                    (LPVOID*)&pMetaHostPolicy);
hr = CLRCreateInstance (CLSID_CLRDebugging, IID_ICLRDebugging,
                    (LPVOID*)&pCLRDebugging);
Requirements

Platforms: See .NET Framework System Requirements.

Header: MetaHost.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: 4

See Also

Other Resources

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View