Nigel Whitworth's Development Site

You are currently not logged in.

How do I change the desktop background using VB.NET?

You will need to declare the WinAPI call SystemParameterInfo first :-

Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Then use the following function passing in the name of the bitmap for the background

Function SetDesktop(ByVal strFilename As String) As Boolean
     Try
          SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, strFilename, 1)
          Return True
     Catch ex As Exception
          Return False
     End Try
End Function


If you intend to vote or make a comment, please enter the security code.

Make a comment

*Comments are the views of individuals, they may or may not be correct.
All comments are reviewed and accepted or rejected.
If you give an email address, you will be sent an email when someone makes a comment on this page.*

Name :
Email :
Comments :


Only name and Code is compulsory.
 
 
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)