BOOL ActivateTheme(PTHEME_SELECTION pSelectedTheme);
void CleanupThemes(IN PTHEME pThemeList);
BOOL DrawThemePreview(HDC hdcMem, PCOLOR_SCHEME scheme, PTHEME_SELECTION pSelectedTheme, PRECT prcWindow);
+BOOL ActivateThemeFile(LPCWSTR pwszFile);
/* prototypes for appearance.c */
INT_PTR CALLBACK AppearancePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
{
HPROPSHEETPAGE hpsp[MAX_DESK_PAGES];
PROPSHEETHEADER psh;
- HPSXA hpsxa;
+ HPSXA hpsxa = NULL;
TCHAR Caption[1024];
UINT i;
LPWSTR *argv = NULL;
{
int argc;
int i;
- LPCWSTR pszCommandLine = (LPCWSTR)lParam;
- argv = CommandLineToArgvW(pszCommandLine, &argc);
+#if 0
+ argv = CommandLineToArgvW((LPCWSTR)lParam, &argc);
+#else
+ argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+#endif
if (argv && argc)
{
for (i = 0; i<argc; i++)
{
+#if 0
if (argv[i][0] == L'@')
pwszSelectedTab = &argv[i][1];
+#else
+ if (wcsncmp(argv[i], L"desk,@", 6) == 0)
+ pwszSelectedTab = &argv[i][6];
+#endif
else if (wcsncmp(argv[i], L"/Action:", 8) == 0)
pwszAction = &argv[i][8];
else if (wcsncmp(argv[i], L"/file:", 6) == 0)
pwszFile = &argv[i][6];
}
}
-
- /* HACK: shell32 doesn't give the correct params to CPL_STARTWPARMSW so we need to ... improvise */
- if (wcsncmp(pszCommandLine, L"/file:", 6) == 0)
- {
- LPCWSTR pwszType = wcsrchr(pszCommandLine, L'.');
- if (pwszType && wcsicmp(pwszType, L".msstyles") == 0)
- {
- pwszFile = &pszCommandLine[6];
- pwszSelectedTab = L"Appearance";
- pwszAction = L"OpenMSTheme";
- }
- }
}
+ if(pwszAction && wcsncmp(pwszAction, L"ActivateMSTheme", 15) == 0)
+ {
+ ActivateThemeFile(pwszFile);
+ goto cleanup;
+ }
+
g_GlobalData.pwszFile = pwszFile;
g_GlobalData.pwszAction = pwszAction;
g_GlobalData.desktop_color = GetSysColor(COLOR_DESKTOP);
PropertySheet(&psh);
+cleanup:
if (hpsxa != NULL)
SHDestroyPropSheetExtArray(hpsxa);
return SUCCEEDED(hres);
}
+
+BOOL ActivateThemeFile(LPCWSTR pwszFile)
+{
+ PTHEME pThemes;
+ THEME_SELECTION selection;
+ COLOR_SCHEME scheme;
+ BOOL ret = FALSE;
+
+ pThemes = LoadThemes();
+ if (!pThemes)
+ return FALSE;
+
+ LoadCurrentScheme(&scheme);
+
+ if (pwszFile)
+ {
+ ret = FindOrAppendTheme(pThemes, pwszFile, NULL, NULL, &selection);
+ if (!ret)
+ goto cleanup;
+
+ ret = LoadSchemeFromTheme(&scheme, &selection);
+ if (!ret)
+ goto cleanup;
+ }
+ else
+ {
+ ret = GetActiveClassicTheme(pThemes, &selection);
+ if (!ret)
+ goto cleanup;
+
+ ret = LoadSchemeFromReg(&scheme, &selection);
+ if (!ret)
+ goto cleanup;
+ }
+
+ ret = ActivateTheme(&selection);
+ if (!ret)
+ goto cleanup;
+
+ ApplyScheme(&scheme, &selection);
+
+ ret = TRUE;
+
+cleanup:
+ CleanupThemes(pThemes);
+
+ return ret;
+}