Johnny5 Posted August 23, 2003 Posted August 23, 2003 Please, if you know how to set the desktop wallpaper by VB.net code so tell me how. tHIS CODE don't work (I don't know why)::mad: Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal lpvParam As String, ByVal fuWinIni As Long) As Long Const SPI_SETDESKWALLPAPER = 20 Const SPIF_UPDATEINIFILE = &H1 SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, "John5.bmp", SPIF_UPDATEINIFILE) Thank you. :) Quote
Leaders dynamic_sysop Posted August 23, 2003 Leaders Posted August 23, 2003 you really need to use Integers rather than Longs , eg: 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 As Integer = 20 Private Const SPIF_UPDATEINIFILE As Integer = 1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim od As New OpenFileDialog() With od .Filter = "Bitmaps(*.bmp)|*.bmp" '/// only seems to work on bitmaps ( atleast on XP pro here ) .InitialDirectory = "C:\" End With If od.ShowDialog = DialogResult.OK Then If MessageBox.Show("would you like the changes to remain next time you re-boot", Application.ProductName, MessageBoxButtons.YesNo) = DialogResult.OK Then SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, od.FileName, SPIF_UPDATEINIFILE) Else '/// dont save changes for after reboot. SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, od.FileName, 0) End If End If End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.