doulostheou
Registered User.
- Local time
- Yesterday, 18:22
- Joined
- Feb 8, 2002
- Messages
- 314
I am just trying to change the wallpaper through code. The intent is to create a database that will randomly display different wallpapers. I know there are plenty of utilities freely available online that do this, but it is always more fun when you do something yourself.
I believe I found the API function that I need to make this happen, but it is not working, and I am led to believe that it would be something I am doing wrong. If someone could review what I have and let me know where I am going wrong, I would appreciate it. When the code runs, x equals 0 and nothing seems to happen...
I am running Windows 98 if that makes a difference, but I wouldn't that is the case.
I believe I found the API function that I need to make this happen, but it is not working, and I am led to believe that it would be something I am doing wrong. If someone could review what I have and let me know where I am going wrong, I would appreciate it. When the code runs, x equals 0 and nothing seems to happen...
I am running Windows 98 if that makes a difference, but I wouldn't that is the case.
Code:
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
Public Const SPI_SETDESKWALLPAPER = 20
Public Const SPIF_SENDWININICHANGE = &H2
Sub ChangeWallpaper()
Dim strBitmapImage As String
Dim x As Long
strBitmapImage = "E:\My Documents\My Pictures\Circles.bmp"
x = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, strBitmapImage, SPIF_SENDWININICHANGE)
debug.print x
End Sub
Last edited: