Estado de excepción digital
Hace 2 meses
...Apuntes de lo que vaya aprendiendo, algo así como el cuaderno del programador...
UINT WINAPI ExtractIconEx(
__in LPCTSTR lpszFile,
__in int nIconIndex,
__out_opt HICON *phiconLarge,
__out_opt HICON *phiconSmall,
__in UINT nIcons
);
//Para obtener un solo ícono
[DllImport("shell32.dll", CharSet=CharSet.Auto)]
internal static extern int ExtractIconEx(string stExeFileName, int nIconIndex, ref IntPtr phiconLarge, ref IntPtr phiconSmall, int nIcons);
//Para obtener un array de íconos
[DllImport("shell32.dll", CharSet=CharSet.Auto)]
internal static extern int ExtractIconEx(string stExeFileName, int nIconIndex, IntPtr[] phiconLarge, IntPtr[] phiconSmall, int nIcons);
private static IntPtr GetHicon(string exePath)
{
//sólo obtendré el largeIcon
IntPtr largeIcon = IntPtr.Zero;
IntPtr smallIcon = IntPtr.Zero;
ExtractIconExA(exePath, 0, ref largeIcon, ref smallIcon, 1);
DestroyIcon(smallIcon);
return largeIcon;
}