How to make a Wallpaper Changer
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
7 posts
Page 1 of 1
Hello everyone,
As I said before while posting my Wallpaper Changer application that I will post a tutorial, I am posting it now. What you will learn in this tutorial is how to change the Desktop's wallpaper by using an application. Its pretty simple and short-length coding. So the tutorial will just as easy to follow. Please don't post any type of negative comments.
---------------------------------------------------------------------------
First of all, open Visual Basic 2008, create a new project, choose Windows Forms Application, type in the textbox Wallpaper Changer and press the OK button. As soon as you have done this, the Form1 will appear on the screen on which we will design our application and code it.
First we will do the designing and then the coding. So now we will change the Form1's properties to make it look good. Change the Form1's Text property to Wallpaper Changer. Change it's StartPosition property to CenterScreen. Change it's FormBorderStyle to FixedSingle. Change it's MaximizeBox property to False.
Now add the following things to the form:
(1)_ 1 PictureBox. Change it's SizeMode property to StretchImage. Change it's BorderStyle property to FixedSingle.
(2)_ 2 Buttons. Change Button1's Text property to Browse... and Button2's Text property to Set Wallpaper.
Now is the time to code Form1 and it's components. So right-click on the form in the Solution Explorer and click View Code.
Type the following code before Public Class Form1:
---------------------------------------------------------------------------
Voila! You have just completed making a Wallpaper Changer which sets the wallpaper of your desktop with the image that you choose. Now debug and run it by pressing the Start Debugging button located at the main toolstrip. Test it, if it works fine then its SAVING time. You can save your project by going to File -> Save All and then pressing Save.
And there! You have your project and application that works. If you have any problem or can't understand something, please feel free to ask by either a comment or by PM. I have also attached a screenshot.
Please use the Give Thanks button and the Reputation System to appreciate my hard work. I have wrote this tutorial while making an Icon Extractor project myself so you can download the source file in the attachments.
Thank you.
![Image]()
As I said before while posting my Wallpaper Changer application that I will post a tutorial, I am posting it now. What you will learn in this tutorial is how to change the Desktop's wallpaper by using an application. Its pretty simple and short-length coding. So the tutorial will just as easy to follow. Please don't post any type of negative comments.
---------------------------------------------------------------------------
First of all, open Visual Basic 2008, create a new project, choose Windows Forms Application, type in the textbox Wallpaper Changer and press the OK button. As soon as you have done this, the Form1 will appear on the screen on which we will design our application and code it.
First we will do the designing and then the coding. So now we will change the Form1's properties to make it look good. Change the Form1's Text property to Wallpaper Changer. Change it's StartPosition property to CenterScreen. Change it's FormBorderStyle to FixedSingle. Change it's MaximizeBox property to False.
Now add the following things to the form:
(1)_ 1 PictureBox. Change it's SizeMode property to StretchImage. Change it's BorderStyle property to FixedSingle.
(2)_ 2 Buttons. Change Button1's Text property to Browse... and Button2's Text property to Set Wallpaper.
Now is the time to code Form1 and it's components. So right-click on the form in the Solution Explorer and click View Code.
Type the following code before Public Class Form1:
Code: Select all
Type the following code after Public Class Form1:
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Drawing.Imaging
Code: Select all
Write the following code by double-clicking Button1 whose Text property was Browse...:
Inherits System.Windows.Forms.Form
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As String, ByVal fuWinIni As Integer) As Integer
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_UPDATEINIFILE = &H1
Code: Select all
Write the following code by double-clicking Button2 whose Text property was Set Wallpaper:
Dim dlg As OpenFileDialog = New OpenFileDialog
dlg.Filter = "Image Files (*.bmp, *.gif, *.jpg, *.png)|*.bmp;*.gif;*.jpg;*.png"
dlg.Title = "Select the image to load."
dlg.ShowDialog()
PictureBox1.Image = Image.FromFile(dlg.FileName)
dlg.Dispose()
Code: Select all
Well, that's all. It was real easy, wasn't it?Dim imagePath As String = Application.StartupPath & "\New Wallpaper.bmp"
PictureBox1.Image.Save(imagePath, ImageFormat.Bmp)
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, imagePath, SPIF_UPDATEINIFILE)
---------------------------------------------------------------------------
Voila! You have just completed making a Wallpaper Changer which sets the wallpaper of your desktop with the image that you choose. Now debug and run it by pressing the Start Debugging button located at the main toolstrip. Test it, if it works fine then its SAVING time. You can save your project by going to File -> Save All and then pressing Save.
And there! You have your project and application that works. If you have any problem or can't understand something, please feel free to ask by either a comment or by PM. I have also attached a screenshot.
Please use the Give Thanks button and the Reputation System to appreciate my hard work. I have wrote this tutorial while making an Icon Extractor project myself so you can download the source file in the attachments.
Thank you.

You do not have the required permissions to view the files attached to this post.
Nice tut! :')
I have a little question.
How can I make it change the wallpaper to a wallpaper in :C\ which I chose.
Hope you can help me! :')
I have a little question.
How can I make it change the wallpaper to a wallpaper in :C\ which I chose.
Hope you can help me! :')
Try:
Code: Select all
Const SPI_SETDESKWALLPAPER As UInteger = &H14
Const SPIF_UPDATEINIFILE As UInteger = &H1
<DllImport("user32.dll")> Shared Function SystemParametersInfo(ByVal uiAction As UInteger, ByVal uiParam As UInteger, ByVal pvParam As String, ByVal fWinIni As UInteger) As Boolean
End Function
Private Sub btnSet_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSet.Click
' Where txtWallpaper is a textbox containing something like C:\test.bmp
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, txtWallpaper.Text, SPIF_UPDATEINIFILE)
End Sub
iLenkaa wrote:Nice tut! :')That is not at all difficult. Didn't you saw the Browse button? And yes, you can also do it in mandai's way.
I have a little question.
How can I make it change the wallpaper to a wallpaper in :C\ which I chose.
Hope you can help me! :')
I've created a wallpaper changer and it chnage a wallpaper on every 10 min =D
I have seen it, and it isn't difficult. You just have to put the change wallpaper button code into a timer with some change of code.
Usman55 wrote:I have seen it, and it isn't difficult. You just have to put the change wallpaper button code into a timer with some change of code.true (A)
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023