/// <summary> /// Gibt das große Icon des Pfades aus /// </summary> /// <param name="pfad">Der Pfad zu einem Ordner oder Datei</param> /// <returns></returns> public static Icon GetLargeIcon(string pfad) { IntPtr hImgSmall = default(IntPtr); //The handle to the system image list. WinAPI.SHFILEINFO shinfo = new WinAPI.SHFILEINFO(); shinfo.szDisplayName = new string((char)0, 260); shinfo.szTypeName = new string((char)0, 80); hImgSmall = WinAPI.SHGetFileInfo(pfad, 0, ref shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_LARGEICON); System.Drawing.Icon myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon); return(myIcon); }
/// <summary> /// Gibt das kleine Icon des Pfades aus /// </summary> /// <param name="pfad">Der Pfad zu einem Ordner oder Datei</param> /// <returns></returns> public static Icon GetSmallIcon(string pfad) { IntPtr hImgSmall = default(IntPtr); //The handle to the system image list. WinAPI.SHFILEINFO shinfo = new WinAPI.SHFILEINFO(); shinfo.szDisplayName = new string((char)0,260); shinfo.szTypeName = new string((char)0, 80); hImgSmall = WinAPI.SHGetFileInfo(pfad, 0, ref shinfo, Marshal.SizeOf(shinfo), SHGFI_ICON | SHGFI_SMALLICON); System.Drawing.Icon myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon); return myIcon; }