Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing the desktop background.

Status
Not open for further replies.

jcisco2

Programmer
Joined
Apr 13, 2004
Messages
102
Location
US
I have a question about switching out the desktop background when the user clicks on one of my pictureboxes in my program.

Right now i'm trying to use this code. it's not throwing an err but it's not working either. I wondering if anyone has any suggestions on this. thanks .

Private Const SPI_SETDESKWALLPAPER As Integer = &H14
Private Const SPIF_UPDATEINIFILE As Integer = &H1
Private Const SPIF_SENDWININICHANGE As Integer = &H2
private path as string = "C:\images\apple.jpg"

Private Declare Auto Function SystemParametersInfo Lib "user32.dll" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, path, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub


 
my above code works it's just the image that is going to be the new background has to be in bmp form.


cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top