Changing Windows Wallpaper using Managed Code? [Resolved]
In VB6 i have this terrific piece of code that i use to change the Windows wallpaper. It changes JPEGs, BMPs etc. How would i do this in VB.NET 2003? Any ideas?
VB Code:
Private Declare Function SystemParametersInfo Lib "user32" Alias _
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _
ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPI_SETDESKWALLPAPER = 20
VB Code:
SavePicture pPicture, "C:\WINDOWS\Web\Wallpaper\Current Wallpaper.bmp"
ret = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, ByVal "C:\WINDOWS\Web\Wallpaper\Current Wallpaper.bmp", _
SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE)
Re: Changing Windows Wallpaper using Managed Code?
Just look in MSDN under API functions and you should be able to find a way to wrap the declaration in a way that works from vb.net.