[MSPAINT]
[reactos.git] / reactos / base / applications / mspaint / registry.cpp
index f89674c..e295530 100644 (file)
@@ -35,27 +35,18 @@ static void ReadFileHistory(CRegKey &key, LPCTSTR lpName, CString &strFile)
     strFile.ReleaseBuffer();
 }
 
-void RegistrySettings::SetWallpaper(LPCTSTR szFileName, DWORD dwStyle, DWORD dwTile)
+void RegistrySettings::SetWallpaper(LPCTSTR szFileName, RegistrySettings::WallpaperStyle style)
 {
-    // TODO: find out whether this line still serves a purpose
-    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE);
-
-    if ((dwStyle > 2) || (dwTile > 2))
-        return;
-
     CRegKey desktop;
     if (desktop.Open(HKEY_CURRENT_USER, _T("Control Panel\\Desktop")) == ERROR_SUCCESS)
     {
-        TCHAR szStyle[3], szTile[3];
-
         desktop.SetStringValue(_T("Wallpaper"), szFileName);
 
-        _stprintf(szStyle, _T("%lu"), dwStyle);
-        _stprintf(szTile, _T("%lu"), dwTile);
-
-        desktop.SetStringValue(_T("WallpaperStyle"), szStyle);
-        desktop.SetStringValue(_T("TileWallpaper"), szTile);
+        desktop.SetStringValue(_T("WallpaperStyle"), (style == RegistrySettings::STRETCHED) ? _T("2") : _T("0"));
+        desktop.SetStringValue(_T("TileWallpaper"), (style == RegistrySettings::TILED) ? _T("1") : _T("0"));
     }
+
+    SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
 }
 
 void RegistrySettings::LoadPresets()