I've been wanting to make a program that immediatly sets my wallpaper to 1 picture, waits 10 seconds, then sets it to the other.
The program works just fine when running it from command prompt, or using the python interpreter. But as a service, it doesn't work.
I have used nssm (Non-Sucking Service Manager) to turn the script into a service.
Here's the wallpaper changing part of the code:
def change_wallpaper(filename):
# Load the user32 library.
user32 = ctypes.WinDLL('user32')
# Set the wallpaper.
result = user32.SystemParametersInfoW(
win32con.SPI_SETDESKWALLPAPER, 0, filename, win32con.SPIF_UPDATEINIFILE
)
# Check the result.
if not result:
print("Failed to set wallpaper.")
else:
print("Successfully set wallpaper.")
I captured the I/O to a log file to find out if it had worked or not and it said "Failed to set wallpaper".
So.. I'm kind of stuck. Thanks to anyone who can help. :)
What I was expecting
I was expecting it to change the wallpaper, then after 10 seconds change it to another.
What actually happened
It reported that changing the wallpaper failed.