I already manage to change programmatically my desktop background via this one-liner:
DllCall("user32.dll", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $CmdLine[1], "int", 0)
(via drag 'n' drop of the desired wallpaper onto the compiled script).
However, this code does even too much for my needs. In fact I have another software that changes the desktop but, for some unknown-to-me reasons, fails to send the WM_SETTINGCHANGE message (I can see the key HKCU\Control Panel\Desktop\Wallpaper getting updated in fact, by the way).
So I ask you: how can I write a simple script that sends this message and thus triggers the wallpaper refresh? And will it work or the first script is the only "real"/"correct" way to proceed programmatically?
I tried this but it doesn't work:
#include-once Global $MAX_VALUE_NAME = 1024 Global $HWND_BROADCAST = 0xffff Global $WM_SETTINGCHANGE = 0x001A Global $SMTO_ABORTIFHUNG = 0x0002 Global $SMTO_NORMAL = 0x0000 Global $MSG_TIMEOUT = 5000 DllCall("user32.dll", "lresult", "SendMessageTimeoutW", _ "hwnd", $HWND_BROADCAST, _ "dword", $WM_SETTINGCHANGE, _ "ptr", 0, _ "wstr", "Environment", _ "dword", $SMTO_ABORTIFHUNG, _ "dword", $MSG_TIMEOUT, _ "dword_ptr*", 0)
Many thanks in advance to whomever will help me!





