public static System.Drawing.Icon GetAppIcon()
{
string fileName = Assembly.GetEntryAssembly().Location;
IntPtr hLibrary = NativeMethods.LoadLibrary(fileName);
if (hLibrary != IntPtr.Zero)
{
IntPtr hIcon = NativeMethods.LoadIcon(hLibrary, "#32512");
if (hIcon != IntPtr.Zero)
{
return System.Drawing.Icon.FromHandle(hIcon);
}
}
return null;
}