try this snippet using the PrivateExtractIcons API:
[DllImport("User32.dll", CharSet = CharSet.Auto)]
internal static extern UInt32 PrivateExtractIcons(String lpszFile, int nIconIndex, int cxIcon, int cyIcon, IntPtr[] phicon, IntPtr[] piconid, UInt32 nIcons, UInt32 flags);
IntPtr[] phicon = new IntPtr[] { IntPtr.Zero };
IntPtr[] piconid = new IntPtr[] { IntPtr.Zero };
PrivateExtractIcons(path, 0, cx, cy, phicon, piconid, 1, 0);
if (phicon[0] != IntPtr.Zero)
return System.Drawing.Icon.FromHandle(phicon[0]);
lupok source
share