nparra
04-05-2004, 01:49 PM
I would really appreciate if anyone could help me on how to change wallpaper with Visual Basic.net . I tried using the "systemparametersinfo" API that is commongly used in Visual Basic 6.0 but it didn't work?
The code I used in VB .Net was the following:
Public Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByRef lpvParam As String, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_SENDWININICHANGE As Long = &H2
Public Const SPIF_UPDATEINIFILE As Long = &H1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xfile As String
xfile = "c:\untitled.bmp"
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, xfile, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
End Sub
The code I used in VB .Net was the following:
Public Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByRef lpvParam As String, ByVal fuWinIni As Long) As Long
Private Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_SENDWININICHANGE As Long = &H2
Public Const SPIF_UPDATEINIFILE As Long = &H1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim xfile As String
xfile = "c:\untitled.bmp"
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, xfile, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
End Sub