Esempio n. 1
0
        internal static void Get(ref BitmapSource icon, string source, SHFlags flags)
        {
            if (iImageList == null)
            {
                return;
            }

            try
            {
                SHFILEINFO shinfo = new SHFILEINFO();
                IntPtr     hIml   = SafeNativeMethods.SHGetFileInfo(source, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)(flags));
                getIcon(ref icon, ref shinfo, hIml);
            }
            catch { }
        }
Esempio n. 2
0
        internal static void Get(ref BitmapSource icon, int source, SHFlags flags)
        {
            try
            {
                IntPtr ppidl = IntPtr.Zero;
                int    r     = SafeNativeMethods.SHGetFolderLocation(IntPtr.Zero, source, IntPtr.Zero, 0, out ppidl);
                if (r != 0)
                {
                    return;
                }

                SHFILEINFO shinfo = new SHFILEINFO();
                IntPtr     hIml   = SafeNativeMethods.SHGetFileInfo(ppidl, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)(flags));

                getIcon(ref icon, ref shinfo, hIml);
            }
            catch { }
        }