Hi all, I am trying to change the wallpaper on the desktop through Access, I have the attached code which half works but I'm going to need somebodys help to get it working correctly.
Option Compare Database
Option Explicit
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_SENDWININICHANGE = &H2
' Enter the following Declare as one, single line:
Private Declare Function SystemParametersInfo Lib "User32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uparam As Integer, lpvParam As Any, ByVal fuWinIni As Integer) As Integer
Private Sub Command1_Click()
Dim filenm As String
Dim x As Long
filenm = "c:\winnt\Bgt.bmp"
' Enter the following two lines as one, single line:
x = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, filenm, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub
The code is attached to a button on a form, when I click the button it clears the current wallpaper on the desktop but doesn't replace it with the file I specified. Can anybody see where I am going wrong and help me out.
Thanks in advance. Steven.
Option Compare Database
Option Explicit
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPI_SETDESKWALLPAPER = 20
Private Const SPIF_SENDWININICHANGE = &H2
' Enter the following Declare as one, single line:
Private Declare Function SystemParametersInfo Lib "User32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uparam As Integer, lpvParam As Any, ByVal fuWinIni As Integer) As Integer
Private Sub Command1_Click()
Dim filenm As String
Dim x As Long
filenm = "c:\winnt\Bgt.bmp"
' Enter the following two lines as one, single line:
x = SystemParametersInfo(SPI_SETDESKWALLPAPER, 0&, filenm, SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
End Sub
The code is attached to a button on a form, when I click the button it clears the current wallpaper on the desktop but doesn't replace it with the file I specified. Can anybody see where I am going wrong and help me out.
Thanks in advance. Steven.