I've googled around a bit to try to find out how to set the desktop background in windows. The following is code that looks like it should work, but for some reason it won't.
Qt Code:
  1. #include "wallpapr.h"
  2. #include <QSettings>
  3. #include <QVariant>
  4. #ifdef WIN32
  5. #include <windows.h>
  6.  
  7.  
  8. Wallpapr::Wallpapr(QWidget *parent)
  9. : QDialog(parent)
  10. {
  11. //ui.setupUi(this);
  12.  
  13. // String *path = "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.bmp";
  14. QString *path = new QString("C:\\Documents and Settings\\Marius\\Local Settings\\Application Data\\Microsoft\\Wallpaper1.bmp");
  15. //C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.bmp");
  16. QSettings *settings = new QSettings("HKEY_CURRENT_USER\\Control Panel\\Desktop",
  17. QSettings::NativeFormat);
  18. //ui.oldWallpaper->setText(settings->value("Wallpaper").toString());
  19. settings->setValue("Wallpaper", QVariant(*path));//"C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.bmp");
  20. //settings->setValue("ConvertedWallpaper", QVariant(*path));//"C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.bmp");
  21. //settings->setValue("OriginalWallpaper", QVariant(*path));//"C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Sunset.bmp");
  22. //ui.tempWallpaper->setText(settings->value("Wallpaper").toString());
  23. SystemParametersInfo(SPI_SETDESKWALLPAPER, 1, path, SPIF_SENDWININICHANGE);
  24. //ui.newWallpaper->setText(settings->value("Wallpaper").toString());
  25.  
  26. }
  27.  
  28. Wallpapr::~Wallpapr()
  29. {
  30.  
  31. }
  32. #endif
To copy to clipboard, switch view to plain text mode 
It changes the registry values, but only removes the current wallpaper. The desktop is a clear color after running the program.

Anyone know how I could make it work?