return FALSE;
}
- HICON hIcon = (HICON)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
+ /* Load icon from registry */
+ HICON hIcon = NULL;
+ ATL::CStringW szIconPath;
+ if (InstAppInfo->RetrieveIcon(szIconPath))
+ {
+ PathParseIconLocationW((LPWSTR)szIconPath.GetString());
+
+ /* Load only the 1st icon from the application executable,
+ * because all apps provide the executables which have the main icon
+ * as 1st in the index , so we don't need other icons here */
+ hIcon = ExtractIconW(hInst,
+ szIconPath.GetString(),
+ 0);
+ }
+
+ if (!hIcon)
+ {
+ /* Load default icon */
+ hIcon = LoadIconW(hInst, MAKEINTRESOURCEW(IDI_MAIN));
+ }
int IconIndex = ImageList_AddIcon(m_hImageListView, hIcon);
DestroyIcon(hIcon);
return TRUE;
}
// **** CApplicationView ****
-
using namespace Gdiplus;
-#define LISTVIEW_ICON_SIZE 24
+#define LISTVIEW_ICON_SIZE 32
// default broken-image icon size
#define BROKENIMG_ICON_SIZE 96
CInstalledApplicationInfo(BOOL bIsUserKey, REGSAM RegWowKey, HKEY hKey);
BOOL GetApplicationRegString(LPCWSTR lpKeyName, ATL::CStringW& String);
BOOL GetApplicationRegDword(LPCWSTR lpKeyName, DWORD *lpValue);
+ BOOL RetrieveIcon(ATL::CStringW& IconLocation);
BOOL UninstallApplication(BOOL bModify);
LSTATUS RemoveFromRegistry();
+ ATL::CStringW szDisplayIcon;
ATL::CStringW szDisplayName;
ATL::CStringW szDisplayVersion;
ATL::CStringW szPublisher;
return TRUE;
}
+BOOL CInstalledApplicationInfo::RetrieveIcon(ATL::CStringW& IconLocation)
+{
+ if (szDisplayIcon.IsEmpty())
+ {
+ return FALSE;
+ }
+ IconLocation = szDisplayIcon;
+ return TRUE;
+}
+
BOOL CInstalledApplicationInfo::UninstallApplication(BOOL bModify)
{
return StartProcess(bModify ? szModifyPath : szUninstallString, TRUE);
// those items without display name are ignored
if (Info->GetApplicationRegString(L"DisplayName", Info->szDisplayName))
{
+ Info->GetApplicationRegString(L"DisplayIcon", Info->szDisplayIcon);
Info->GetApplicationRegString(L"DisplayVersion", Info->szDisplayVersion);
Info->GetApplicationRegString(L"Publisher", Info->szPublisher);
Info->GetApplicationRegString(L"RegOwner", Info->szRegOwner);