BExplorer.Shell.Interop.Ole32.CoCreateInstance C# (CSharp) Method

CoCreateInstance() private method

private CoCreateInstance ( System.Guid &rclsid, IntPtr pUnkOuter, CLSCTX dwClsContext, System.Guid &riid, IntPtr &ppv ) : HResult
rclsid System.Guid
pUnkOuter System.IntPtr
dwClsContext CLSCTX
riid System.Guid
ppv System.IntPtr
return HResult
		public static extern HResult CoCreateInstance(ref Guid rclsid, IntPtr pUnkOuter, CLSCTX dwClsContext, ref Guid riid, out IntPtr ppv);
		[DllImport("ole32.dll", CharSet = CharSet.Auto, SetLastError = true)]

Usage Example

Example #1
0
        /// <summary>
        /// Internal constructor that takes in a parent ShellObject.
        /// </summary>
        /// <param name="shellObject"></param>
        internal ShellThumbnail(ShellItem shellObject)
        {
            if (shellObject != null && shellObject.ComInterface != null)
            {
                _Item           = shellObject;
                shellItemNative = shellObject.ComInterface;
                if (ThumbnailCache == null)
                {
                    Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");
                    Guid CLSID_LocalThumbnailCache = new Guid("50EF4544-AC9F-4A8E-B21B-8A26180DB13F");

                    IntPtr cachePointer;
                    Ole32.CoCreateInstance(ref CLSID_LocalThumbnailCache, IntPtr.Zero, Ole32.CLSCTX.INPROC, ref IID_IUnknown, out cachePointer);

                    ThumbnailCache = (IThumbnailCache)Marshal.GetObjectForIUnknown(cachePointer);
                }
            }
        }