public static object GetRuntimeInterfaceAsObject(Guid clsid, Guid riid) { IntPtr pUnk = IntPtr.Zero; try { pUnk = RuntimeEnvironment.GetRuntimeInterfaceImpl(clsid, riid); return(Marshal.GetObjectForIUnknown(pUnk)); } finally { if (pUnk != IntPtr.Zero) { Marshal.Release(pUnk); } } }
public static object GetRuntimeInterfaceAsObject(Guid clsid, Guid riid) { IntPtr intPtr = IntPtr.Zero; object objectForIUnknown; try { intPtr = RuntimeEnvironment.GetRuntimeInterfaceImpl(clsid, riid); objectForIUnknown = Marshal.GetObjectForIUnknown(intPtr); } finally { if (intPtr != IntPtr.Zero) { Marshal.Release(intPtr); } } return(objectForIUnknown); }
public static IntPtr GetRuntimeInterfaceAsIntPtr(Guid clsid, Guid riid) { return(RuntimeEnvironment.GetRuntimeInterfaceImpl(clsid, riid)); }