IActiveDesktop wallpaper fade effect not working a

2020-07-26 11:17发布

问题:

Am I missing something using IActiveDesktop?

Sympthoms: After system (Win7/Win8) restart fade effect during wallpaper change disappears.

To restore it I have to manually go to "Personalization->Desktop Backgrounds" and set "Picture Location" from "My Pictures"(?) back to "Windows Desktop Backgrounds" and then back(!). After this action fade effect is working fine again until the next system restart.

I don't understand what reverts it back and how to stop it. How to set "Windows Desktop Background" option programmatically? What system does in background?

Code itself is pretty standard and taken from MSDN/CodeProject.

回答1:

You have to tell windows that you want to enable ActiveDesktop. I tell it every time right before setting the wallpaper through ActiveDesktop.

public static void EnableActiveDesktop()
{
    IntPtr result = IntPtr.Zero;
    WinAPI.SendMessageTimeout(WinAPI.FindWindow("Progman", null), 0x52c, IntPtr.Zero, IntPtr.Zero, 0, 500, out result);
}

You can see this in context here: https://pulse.codeplex.com/SourceControl/changeset/view/72677#1589017



标签: wallpaper