Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
im trying to make a program that randomly chooses a picture out of a folder to use as my new desktop background.
i have everything done except the code where i would right click on the image and choose "set as desktop background". all of the files and folders are saved on my computer and everything works perfectly...
actually... another problem that i have with this is when i resize the images to fit in my program some pictures become blurry. is there a way to fix that? i dont have my exact code with me right now but i would be able to tell you if what you did was the same. and yes, when i resize the image, i make it the same ratio as the original. thanks a lot for any help!
FBI Agent
AIM: EliteAssassin187

THe desktop wall paper is set using the registry key:
HKEY_CURRENT_USER\Control Panel\Desktop\ConvertedWallpaperI don't know how to refresh yet...but let me test something....
Chi
They mostly come at night...mostly.

Forget about the registry...
Here is some code to do it in c# (you should be able to convert this to vb.net pretty easily)if(openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
System.IO.Stream s = new System.Net.WebClient( ).OpenRead( openFileDialog1.FileName );System.Drawing.Image img = System.Drawing.Image.FromStream( s );
string tempPath = Path.Combine( Path.GetTempPath( ), "wallpaper.bmp" ) ;
img.Save( tempPath , System.Drawing.Imaging.ImageFormat.Bmp ) ;
SystemParametersInfo( SPI_SETDESKWALLPAPER,
0,
tempPath,
SPIF_SENDWININICHANGE );
}
you also need this stuff:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ;const int SPI_SETDESKWALLPAPER = 20 ;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDWININICHANGE = 0x02;
Hope this helps,
ChiThey mostly come at night...mostly.

![]() |
I cant connect to the int...
|
trace shared folder acces...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |