fix warnings (untested)
authorChristoph von Wittich <christoph_vw@reactos.org>
Mon, 15 Jun 2009 15:04:56 +0000 (15:04 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Mon, 15 Jun 2009 15:04:56 +0000 (15:04 +0000)
svn path=/trunk/; revision=41419

reactos/base/applications/paint/main.c
reactos/base/applications/paint/registry.c
reactos/base/applications/paint/registry.h
reactos/base/applications/paint/winproc.c

index a6b9338..3fed5eb 100644 (file)
@@ -223,7 +223,7 @@ int WINAPI _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR l
     hCurPen         = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_PEN));
     hCurAirbrush    = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDC_AIRBRUSH));
 
-    HWND hLine = CreateWindowEx (0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
+    CreateWindowEx (0, _T("STATIC"), _T(""), WS_CHILD | WS_VISIBLE | SS_ETCHEDHORZ, 0, 0, 5000, 2, hwnd, NULL, hThisInstance, NULL);
 
     // creating the 16 bitmap radio buttons and setting the bitmap
 
index e423d0d..21391cc 100644 (file)
@@ -9,31 +9,30 @@
 /* INCLUDES *********************************************************/
 
 #include <windows.h>
+#include <tchar.h>
 
 /* FUNCTIONS ********************************************************/
 
-void setWallpaper(char fname[], int style)
+void SetWallpaper(TCHAR *FileName, DWORD dwStyle, DWORD dwTile)
 {
-    HKEY hkeycontrolpanel;
-    HKEY hkeydesktop;
-    RegOpenKeyEx(HKEY_CURRENT_USER, "Control Panel", 0, 0, hkeycontrolpanel);
-    RegOpenKeyEx(hkeycontrolpanel, "Desktop", 0, KEY_SET_VALUE, hkeydesktop);
-    RegSetValueEx(hkeydesktop, "Wallpaper", 0, REG_SZ, fname, sizeof(fname));
-    switch (style)
+    HKEY hDesktop;
+    TCHAR szStyle[3], szTile[3];
+
+    if ((dwStyle > 2) || (dwTile > 2))
+        return;
+
+    if (RegOpenKeyEx(HKEY_CURRENT_USER, 
+        _T("Control Panel\\Desktop"), 0,
+        KEY_READ | KEY_SET_VALUE, &hDesktop) == ERROR_SUCCESS)
     {
-        case 0:
-            RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "2", 2);
-            RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "0", 2);
-            break;
-        case 1:
-            RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "1", 2);
-            RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "0", 2);
-            break;
-        case 2:
-            RegSetValueEx(hkeydesktop, "WallpaperStyle", 0, REG_SZ, "1", 2);
-            RegSetValueEx(hkeydesktop, "TileWallpaper", 0, REG_SZ, "1", 2);
-            break;
+        RegSetValueEx(hDesktop, _T("Wallpaper"), 0, REG_SZ, (LPBYTE) FileName, _tcslen(FileName) * sizeof(TCHAR));
+
+        _stprintf(szStyle, _T("%i"), dwStyle);
+        _stprintf(szTile,  _T("%i"), dwTile);
+
+        RegSetValueEx(hDesktop, _T("WallpaperStyle"), 0, REG_SZ, (LPBYTE) szStyle, _tcslen(szStyle) * sizeof(TCHAR));
+        RegSetValueEx(hDesktop, _T("TileWallpaper"), 0, REG_SZ, (LPBYTE) szTile, _tcslen(szTile) * sizeof(TCHAR));
+
+        RegCloseKey(hDesktop);
     }
-    RegCloseKey(hkeydesktop);
-    RegCloseKey(hkeycontrolpanel);
 }
index 035d15c..c3f187e 100644 (file)
@@ -6,4 +6,4 @@
  * PROGRAMMERS: Benedikt Freisen
  */
 
-void setWallpaper(char fname[], int style);
+void SetWallpaper(TCHAR *szFileName, DWORD dwStyle, DWORD dwTile);
index 2f4a316..35ecab8 100644 (file)
@@ -423,13 +423,13 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
                     }
                     break;
                 case IDM_FILEASWALLPAPERPLANE:
-                    setWallpaper(filepathname, 2);
+                    SetWallpaper(filepathname, 1, 1);
                     break;
                 case IDM_FILEASWALLPAPERCENTERED:
-                    setWallpaper(filepathname, 1);
+                    SetWallpaper(filepathname, 1, 0);
                     break;
                 case IDM_FILEASWALLPAPERSTRETCHED:
-                    setWallpaper(filepathname, 0);
+                    SetWallpaper(filepathname, 2, 0);
                     break;
                 case IDM_EDITUNDO:
                     undo();