Jump to content

wallpaper changing


easonadam

Recommended Posts

After some quick searching on Google, I found a few examples of software which state can accomplish this goal:

 

 

 

Automatic Wallpaper Changer

 

http://awc.smurphy.co.uk/

 

 

 

Stardust Wallpaper Control (this one mentions being able to set the wallpaper to change at startup)

 

http://www.snapfiles.com/get/stardustwall.html

 

 

 

ScrollWall 1.2

 

http://www.softpedia.com/get/Desktop-Enhancements/Other-Desktop-Enhancements/ScrollWall.shtml

 

 

 

Moody Desktop

 

http://www.zeroideas.net/MDesktop/Index.html

Link to comment
Share on other sites

I actually made you a simple little application that will change it every time the computer starts up. To use it you need to make a shortcut to the application in your startup folder. Make the location of the shortcut C:\the\path\to\the\changer[Caution: Executable File] C:\the\path\to\images. You can use a batch file to if you wish. Put all your images in one directory and that is what it will use. I tested this using 3 jpg images in a directory and it worked fine i am sure bugs will appear as it is 5 a.m and i have been up all night and i am tired. Just let me know and i will fix them. You can download a copy of it compiled here. I will post the source too.

 

 

 


#include 

#include 

#include 

#include 

#include 

#include 

#include 



using namespace std;



bool checkFile(string file)

{

int x = 0;

char * ext, * imgFile;

imgFile = new char [file.size() + 1];



strcpy(imgFile, file.c_str());

char * img = strtok(imgFile, ".");



while(img != NULL)

{

	ext = img;

	img = strtok(NULL, ".");

}



string types[8] = {"jpg", "jpeg", "jpe", "gif", "tif", "tiff", "png", "bmp"};



for(x = 0; x < 8; x++)

{

	if(types[x] == ext)

	{

		return true;

	}

}



return false;

}



int main(int argc, char * argv[])

{

int i = 0, x = 0, change = 0;

vector files;

DIR * open;

struct dirent * read;



open = opendir(argv[1]);



if(!open)

{

	MessageBox(NULL, "The directory you have set is invalid!", "Wallpaper Changer", MB_OK | MB_ICONERROR);

	exit(1);

}



while(read = readdir(open))

{

	if(checkFile(string(read -> d_name)))

	{

		files.push_back(string(read -> d_name)); 

		i++;

	}

}



closedir(open);



srand(time(NULL));

x = rand() % files.size();



string imgFile;



imgFile = argv[1];

imgFile = imgFile + "\\" + files[x];



char * img;

img = new char [imgFile.size()];



strcpy(img, imgFile.c_str());



change = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, img, SPIF_UPDATEINIFILE);



if(change == 0)

{

	MessageBox(NULL, "Could not change the wallpaper!", "Wallpaper Changer", MB_OK | MB_ICONERROR);

}



return 0;

}



Link to comment
Share on other sites

[hide=]I actually made you a simple little application that will change it every time the computer starts up. To use it you need to make a shortcut to the application in your startup folder. Make the location of the shortcut C:\the\path\to\the\changer[Caution: Executable File] C:\the\path\to\images. You can use a batch file to if you wish. Put all your images in one directory and that is what it will use. I tested this using 3 jpg images in a directory and it worked fine i am sure bugs will appear as it is 5 a.m and i have been up all night and i am tired. Just let me know and i will fix them. You can download a copy of it compiled here. I will post the source too.

 

 

 


#include 

#include 

#include 

#include 

#include 

#include 

#include 



using namespace std;



bool checkFile(string file)

{

int x = 0;

char * ext, * imgFile;

imgFile = new char [file.size() + 1];



strcpy(imgFile, file.c_str());

char * img = strtok(imgFile, ".");



while(img != NULL)

{

	ext = img;

	img = strtok(NULL, ".");

}



string types[8] = {"jpg", "jpeg", "jpe", "gif", "tif", "tiff", "png", "bmp"};



for(x = 0; x < 8; x++)

{

	if(types[x] == ext)

	{

		return true;

	}

}



return false;

}



int main(int argc, char * argv[])

{

int i = 0, x = 0, change = 0;

vector files;

DIR * open;

struct dirent * read;



open = opendir(argv[1]);



if(!open)

{

	MessageBox(NULL, "The directory you have set is invalid!", "Wallpaper Changer", MB_OK | MB_ICONERROR);

	exit(1);

}



while(read = readdir(open))

{

	if(checkFile(string(read -> d_name)))

	{

		files.push_back(string(read -> d_name)); 

		i++;

	}

}



closedir(open);



srand(time(NULL));

x = rand() % files.size();



string imgFile;



imgFile = argv[1];

imgFile = imgFile + "\\" + files[x];



char * img;

img = new char [imgFile.size()];



strcpy(img, imgFile.c_str());



change = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, img, SPIF_UPDATEINIFILE);



if(change == 0)

{

	MessageBox(NULL, "Could not change the wallpaper!", "Wallpaper Changer", MB_OK | MB_ICONERROR);

}



return 0;

}



[/hide]

 

 

 

I keep getting the error:

 

"The directory you have set is invalid!"

 

While trying to get it working my end.

 

 

 

[hide=Image]24q0h3m.png[/hide]

 

 

 

Have I got the setup all wrong?

Link to comment
Share on other sites

It works fine in vista. It would have to do with line 78 as to why it isn't working in XP. You might try just setting it via the registry which you can do with win32 api. I hav proved the source code so someone else that has time for it can look and make it work better. Also in XP it doesn't like you make parameters in shortcuts so just make a batch file.

 

 

 


start C:\path\to\changer[Caution: Executable File] C:\path\to\images

exit

Link to comment
Share on other sites

thanks slotter, I'm using vista so fingers crossed it'll work for me. Give it a try tomorrow.

 

Great! i have tested it in 32-Bit and 64-Bit vista.

 

 

 

I gave up trying to use it on XP, so put it on my Vista laptop :D

 

 

 

And it works perfect, I tested it quick by logging on and off, new wallpaper each time. Thanks Sloter!

Link to comment
Share on other sites

thanks slotter, I'm using vista so fingers crossed it'll work for me. Give it a try tomorrow.

 

Great! i have tested it in 32-Bit and 64-Bit vista.

 

 

 

I gave up trying to use it on XP, so put it on my Vista laptop :D

 

 

 

And it works perfect, I tested it quick by logging on and off, new wallpaper each time. Thanks Sloter!

 

Thanks for posting that it worked on your vista machine. ;)

Link to comment
Share on other sites

First off put the changer[Caution: Executable File] were you wish. The make a new shortcut in the startup directory. The shortcuts path should C:\the\path\to\the\changer[Caution: Executable File] C:\the\path\to\images. So you putting two paths in the shortcuts location separating them by a space.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.