public static string StrFormatByteSize64(ulong qdw) { StringBuilder StrSize = new StringBuilder(64); Win32imports.StrFormatByteSize64(qdw, StrSize, 64U); return(StrSize.ToString()); }
public static Icon getIconFromFile(String fileName) { /* The Icon.ExtractAssociatedIcon function does not support network drives. */ Icon ico; if (fileName.StartsWith(@"\\")) { Win32imports.SHFILEINFO shinfo = new Win32imports.SHFILEINFO(); IntPtr hIcon = Win32imports.SHGetFileInfo(fileName, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo), (uint)(Win32imports.SHGFI.Icon | Win32imports.SHGFI.LargeIcon)); ico = Icon.FromHandle(shinfo.hIcon); } else { ico = Icon.ExtractAssociatedIcon(fileName); } return(ico); }