private IImage GetFileIconWindows(String fileName, uint fileFlags, uint flags, UIEngine engine, bool large) { SHFileInfo shellInfo = new SHFileInfo(); IntPtr status = SHGetFileInfo(UIUtils.ConvertToWindows(fileName), fileFlags, ref shellInfo, (uint)Marshal.SizeOf(shellInfo), flags); if (IntPtr.Zero != status) { IntPtr hIcon = shellInfo.hIcon; IImage texture = GetIconWindows(hIcon, engine, large); DestroyIcon(hIcon); return(texture); } else { return(null); } }
private IImage GetFileIconWindows(String fileName, uint fileFlags, uint flags, UIEngine engine, bool large) { SHFileInfo shellInfo = new SHFileInfo(); IntPtr status = SHGetFileInfo(UIUtils.ConvertToWindows(fileName), fileFlags, ref shellInfo, (uint)Marshal.SizeOf(shellInfo), flags); if (IntPtr.Zero != status) { IntPtr hIcon = shellInfo.hIcon; IImage texture = GetIconWindows(hIcon, engine, large); DestroyIcon(hIcon); return texture; } else { return null; } }
private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFileInfo psfi, uint cbFileInfo, uint uFlags);
private static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFileInfo psfi, uint cbFileInfo, uint uFlags);