The Computer Oracle

How to force Windows desktop background to update or refresh

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: RPG Blues Looping

--

Chapters
00:00 How To Force Windows Desktop Background To Update Or Refresh
00:21 Accepted Answer Score 20
00:27 Answer 2 Score 5
00:46 Answer 3 Score 2
01:20 Answer 4 Score 4
01:33 Thank you

--

Full question
https://superuser.com/questions/398605/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows7 #windows #windowsregistry

#avk47



ACCEPTED ANSWER

Score 20


RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters 1, True



ANSWER 2

Score 5


  • Open Task manager
  • Kill explorer.exe
  • If the shell doesn't immediately restart
  • From the menu select File > New Task
  • Type "explorer.exe" and hit enter.



ANSWER 3

Score 4


Change the screen resolution, then choose the revert option. Your resolution will remain the same and the background will have changed.

Alternatively, disconnect and reconnect the display cable.




ANSWER 4

Score 2


I was trying to do something similar - update a registry setting for the start menu and then immediately have the start menu reflect the changes.

The solution from this MSDN question worked for me perfectly.

You could try broadcasting a WM_SETTINGCHANGE message. For example:

class Program
{
    [DllImport("user32.dll", SetLastError = true)]
    private static extern IntPtr SendMessageTimeout(IntPtr hWnd, int Msg, IntPtr wParam, string lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult);

    private static readonly IntPtr HWND_BROADCAST = new IntPtr(0xffff);
    private const int WM_SETTINGCHANGE = 0x1a;
    private const int SMTO_ABORTIFHUNG = 0x0002;

    static void Main(string[] args)
    {
        SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, null, SMTO_ABORTIFHUNG, 100, IntPtr.Zero);
    }
}