Refresh icons on upgrade

(Bug #154708, r=curt, sr=deveditz)


git-svn-id: svn://10.0.0.236/trunk@124313 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
curt%netscape.com
2002-06-28 23:03:41 +00:00
parent e250d0bd93
commit a5064d775f
4 changed files with 64 additions and 0 deletions

View File

@@ -2864,6 +2864,10 @@ void DlgSequenceNext()
/* DEPEND_REBOOT process file manipulation functions */
ProcessFileOpsForAll(T_DEPEND_REBOOT);
// Refresh system icons if necessary
if(gSystemInfo.bRefreshIcons)
RefreshIcons();
UnsetSetupState(); // clear setup state
ClearWinRegUninstallFileDeletion();
if(!gbIgnoreProgramFolderX)

View File

@@ -40,6 +40,7 @@
#define HIDWORD(l) ((DWORD) (((ULONG) (l) >> 32) & 0xFFFF))
#define LODWORD(l) ((DWORD) (l))
#define DEFAULT_ICON_SIZE 32
#define INDEX_STR_LEN 10
#define PN_PROCESS TEXT("Process")
#define PN_THREAD TEXT("Thread")
@@ -2498,6 +2499,7 @@ HRESULT InitSetupGeneral()
{
char szBuf[MAX_BUF];
gSystemInfo.bRefreshIcons = FALSE;
sgProduct.dwMode = NORMAL;
sgProduct.dwCustomType = ST_RADIO0;
sgProduct.dwNumberOfComponents = 0;
@@ -5513,6 +5515,58 @@ int CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew)
return(0);
}
void RefreshIcons()
{
char subKey[MAX_BUF];
char iconConstraint[MAX_BUF];
BYTE iconConstraintNew[MAX_BUF];
HKEY hkResult;
DWORD dwValueType;
long iconConstraintSize;
long rv;
// Get the size of the icon from the windows registry.
// When this registry value is changed, the OS can flush the
// icon cache and thus update the icons.
iconConstraintSize = sizeof(iconConstraint);
strcpy(subKey, "Control Panel\\Desktop\\WindowMetrics");
RegOpenKeyEx(HKEY_CURRENT_USER, subKey, 0, KEY_ALL_ACCESS, &hkResult);
rv = RegQueryValueEx(hkResult, "Shell Icon Size", 0, &dwValueType, iconConstraint, &iconConstraintSize);
if(rv != ERROR_SUCCESS || iconConstraintSize == 0)
{
// Key not found or value not found, so use default OS value.
int iIconSize = GetSystemMetrics(SM_CXICON);
if(iIconSize == 0)
// Getting default OS value failed, use hard coded value
iIconSize = DEFAULT_ICON_SIZE;
sprintf(iconConstraint, "%d", iIconSize);
}
// decrease the size of the icon by 1
// and tell the system to refresh the icons
sprintf(iconConstraintNew, "%d", atoi(iconConstraint) - 1);
iconConstraintSize = lstrlen(iconConstraintNew);
RegSetValueEx(hkResult, "Shell Icon Size", 0, dwValueType, iconConstraintNew, iconConstraintSize);
SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
SPI_SETNONCLIENTMETRICS,
(LPARAM)"WindowMetrics",
SMTO_NORMAL|SMTO_ABORTIFHUNG,
10000, NULL);
// reset the original size of the icon
// and tell the system to refresh the icons
iconConstraintSize = lstrlen(iconConstraint);
RegSetValueEx(hkResult, "Shell Icon Size", 0, dwValueType, iconConstraint, iconConstraintSize);
SendMessageTimeout(HWND_BROADCAST,
WM_SETTINGCHANGE,
SPI_SETNONCLIENTMETRICS,
(LPARAM)"WindowMetrics",
SMTO_NORMAL|SMTO_ABORTIFHUNG,
10000, NULL);
}
int CRCCheckArchivesStartup(char *szCorruptedArchiveList, DWORD dwCorruptedArchiveListSize, BOOL bIncludeTempPath)
{
DWORD dwIndex0;
@@ -5829,6 +5883,10 @@ HRESULT ParseConfigIni(LPSTR lpszCmdLine)
GetPrivateProfileString("General", "Program Folder Name", "", szBuf, sizeof(szBuf), szFileIniConfig);
DecryptString(sgProduct.szProgramFolderName, szBuf);
GetPrivateProfileString("General", "Refresh Icons", "", szBuf, sizeof(szBuf), szFileIniConfig);
if(lstrcmpi(szBuf, "TRUE") == 0)
gSystemInfo.bRefreshIcons = TRUE;
/* Welcome dialog */
GetPrivateProfileString("Dialog Welcome", "Show Dialog", "", szShowDialog, sizeof(szShowDialog), szFileIniConfig);
GetPrivateProfileString("Dialog Welcome", "Title", "", diWelcome.szTitle, MAX_BUF, szFileIniConfig);

View File

@@ -213,6 +213,7 @@ BOOL DeleteWGetLog(void);
DWORD ParseOSType(char *szOSType);
BOOL ShowAdditionalOptionsDialog(void);
DWORD GetPreviousUnfinishedState(void);
void RefreshIcons();
#endif /* _EXTRA_H_ */

View File

@@ -546,6 +546,7 @@ struct sSysInfo
DWORD dwScreenX;
DWORD dwScreenY;
BOOL bScreenReader;
BOOL bRefreshIcons;
};
typedef struct diskSpaceNode dsN;