Author: Mike Shkolnik
How can I refresh the Windows desktop after I have set a new background image in
the registry?
Answer:
Solve 1:
I want to post this article because I sure that this question can ask a lot of
developers but to find an answer is not easy task.
So if you need refresh a desktop in run-time, you can execute a next procedure:
1 uses ShlObj;
2 {...}3 SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
This code will refresh a desktop image and re-read the icons for files with
registered extentions.
PS: you can do a same if you press a right mouse button on desktop and select
Update item.
Solve 2:
4 procedure TForm1.Button1Click(Sender: TObject);
5 begin6 SendMessage(FindWindow('Progman', 'Program Manager'), WM_COMMAND, 106597, 0);
7 end;
This has the same effect as pressing F5 in Explorer.