共用方式為


ILocalRegistry3.CreateInstance(Guid, Object, Guid, UInt32, IntPtr) Method

Definition

Creates an instance of a class that is listed in the local registry.

public:
 int CreateInstance(Guid clsid, System::Object ^ punkOuter, Guid % riid, System::UInt32 dwFlags, [Runtime::InteropServices::Out] IntPtr % ppvObj);
public int CreateInstance (Guid clsid, object punkOuter, ref Guid riid, uint dwFlags, out IntPtr ppvObj);
abstract member CreateInstance : Guid * obj * Guid * uint32 * nativeint -> int
Public Function CreateInstance (clsid As Guid, punkOuter As Object, ByRef riid As Guid, dwFlags As UInteger, ByRef ppvObj As IntPtr) As Integer

Parameters

clsid
Guid

[in] Class identifier (CLSID) of the requested object. This CLSID is associated with the data and code that is used to create the object.

punkOuter
Object

[in] Pointer to the controlling instance of IUnknown of the aggregate that uses the newly created object. A value of null indicates that the object is not created as part of an aggregate. If non-null, this is a pointer to the IUnknown interface of the aggregate object (the controlling IUnknown).

riid
Guid

[in] Interface to be used to communicate with the object. For example, IID_IClassFactory.

dwFlags
UInt32

[in] Flags that control the instance creation from the CLSCTX enumeration. Specify a value of CLSCTX_INPROC_SERVER.

ppvObj
IntPtr

nativeint

[out] Address of the pointer variable that receives the interface pointer that is requested in riid. On successful return, ppvObj contains the requested interface pointer. On failure, ppvObj contains null.

Returns

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Implements

Remarks

This method is safe to access from any thread.

Applies to