Click to See Complete Forum and Search --> : c++ change desktop wallpaper


yuriythebest
October 17th, 2009, 11:08 AM
right- currently I have this code:


#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{

SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, "c:/kovtunets2.jpg", SPIF_UPDATEINIFILE );
cin.get();
return 0;
}




the problem is that my wallpaper doesn't change :(

sv13
October 18th, 2009, 07:55 AM
you must convert it to .bmp first and then pass bmp in SystemParametersInfo

yuriythebest
October 18th, 2009, 10:35 AM
yeah I tried with bmp also (converted it)

SystemParametersInfo( SPI_SETDESKWALLPAPER, 0, "C:/kovtunets2.bmp", SPIF_UPDATEINIFILE );
cin.get();
return 0;


still nothing...

sv13
October 18th, 2009, 10:47 AM
just tested it , its not working with jpg, bmp works fine

even your code is working correctly with bmp

hypheni
October 20th, 2009, 03:32 AM
what is "C:/kovtunets2.bmp" ??

It should be.. "C:\\kovtunets2.bmp"

sv13
October 20th, 2009, 07:44 AM
actually both are correct