Improved differentiating office icons, the actual application has a different icon as the "document". For Outlook this is even different for the email & meeting.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1666 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-02-20 12:13:59 +00:00
commit be0569bb21
8 changed files with 117 additions and 47 deletions

View file

@ -51,19 +51,21 @@ namespace GreenshotPlugin.Core {
/// <summary>
/// Internaly used to create an icon
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static Bitmap GetExeIcon(string path) {
/// <param name="path">path to the exe or dll</param>
/// <param name="index">index of the icon</param>
/// <returns>Bitmap with the icon or null if something happended</returns>
public static Bitmap GetExeIcon(string path, int index) {
if (!File.Exists(path)) {
return null;
}
try {
using (Icon appIcon = Icon.ExtractAssociatedIcon(path)) {
using (Icon appIcon = ImageHelper.ExtractAssociatedIcon(path, index, false)) {
if (appIcon != null) {
return appIcon.ToBitmap();
}
}
} catch {
} catch (Exception exIcon) {
LOG.Error("error retrieving icon: ", exIcon);
}
return null;
}