• 0

Fade effect when changing wallpaper?


Question

Hey guys, I'm making a little wallpaper changer since I've finally had enough of Display Fusion's idea of 'random', and I've got it all working nicely, but the only problem is that the wallpaper changes instantly. Whenever Windows 7 or DisplayFusion rotate the wallpaper theres this lovely fade effect, which I'd love to add.

Does anyone have any idea how this is done? The best I can think of is creating multiple images each with different opacity, and then switch between them rapidly, but I doubt thats going to make my CPU very happy.

DisplayFusion has the setting "Use transitions when changing wallpaper (Windows 7 only)", which I can only assume is what I'm after, however Google is returning didly squat as to what exactly that means.

At the moment I'm using,

SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, sGeneratedImagePath, SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);

I've tried using API monitors, but none of them can spy on DisplayFusion since its a .Net application, and they don't seem to return anything interesting when I try and spy on Windows Explorer. I've looked all over the web but I can't really see anything related to wallpapers or transitions in Window's dll files.

Anyone got any ideas? :(

Link to comment
https://www.neowin.net/forum/topic/1035559-fade-effect-when-changing-wallpaper/
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You could try using something like .NET Reflector to see how DisplayFusion does it.

This might also be of some help: http://stackoverflow...ge-in-windows-7

Edit: Just installed DisplayFusion and had a look with .NET Reflector. It's obfuscated, but it's using the IActiveDesktop interface, so I guess it does something like what was mentioned in that link.

Here's the IActiveDesktop interface for C#: http://web.archive.o...goyen/shlobj.cs

Edit2: Well, using the shlobj.cs class I linked you to, this code fades the desktop background to a new one:

IActiveDesktop iad = shlobj.GetActiveDesktop();
iad.SetWallpaper("C:\\Users\\Wolfbane\\Pictures\\Backgrounds\\2YHKN.jpg", 0);
iad.ApplyChanges(AD_Apply.ALL | AD_Apply.FORCE | AD_Apply.BUFFERED_REFRESH);

Now all you need to do is the image selection part :)

  • 0

:o! You're a champ! I looked at IActiveDesktop but MSDN said it was only for XP and below. Dirty rotten liars. :(

Woot, I snooped through the code using .Net Reflector like you suggested and I found out how to enable the transitions. :)


[DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern int SendMessageTimeout(
                  IntPtr hWnd,      // handle to destination window
                  uint Msg,       // message
                  IntPtr  wParam,  // first message parameter
                  IntPtr lParam,   // second message parameter
                    uint fuFlags,
                    uint uTimeout,
                    out IntPtr result

                  );
        [DllImport("user32.dll", SetLastError = true)]
        static extern IntPtr FindWindow(string lpClassName, IntPtr ZeroOnly);


IntPtr result = IntPtr.Zero;
SendMessageTimeout(FindWindow("Progman", IntPtr.Zero), 0x52c, IntPtr.Zero, IntPtr.Zero, 0, 500, out result);

Cheers for your help. :)

This topic is now closed to further replies.
  • Posts

    • BS, I've yet to run into a typical pc user that uses it at all, let alone half the population.
    • Codec Tweak Tool 6.7.7 by Razvan Serea This tool is a Swiss army knife for managing codecs and codec settings. Codec Tweak Tool will scan for broken filters and remove them. If the tool detects something that is broken, it will then prompt you with the details and you will be given the option to remove the broken item. Generate a detailed log of all installed codecs and filters, enable/disable more than 250 popular codecs and filters (if they are installed), manage preferred source filters, and reset settings. With this tool you can do things like: Scan the registry to detect and remove broken references to codecs and filters. Enable/disable more than 200 popular codecs and filters (if they are installed). Manage preferred source filters (a.k.a. splitters). Detect broken codecs and DirectShow filters. Fix problems with the standard DirectShow filters of Windows. A fix for a specific sound problem. Generate a text file with detailed information about all installed codecs and DirectShow filters, along with other relevant system information. Reset settings to recommended values for many popular codecs and DirectShow filters. Configure audio output settings for several popular audio decoders. Several configuration options for a few DirectShow filters that don't have an easily accessible interface for those options. Easy access to the configuration interfaces of various codecs and DirectShow filters Backup the settings of several codecs and DirectShow filters. Replace your current settings with those from a previous backup. Manage DirectShow filters - Enable or disable DirectShow filters. Manage ACM/VFW codecs - Enable or disable ACM/VFW codecs. Enable or disable DirectX Media Objects. Configure your preferred DirectShow source filters (a.k.a. splitters) for several common file extensions. Enable or disable the generation of thumbnails for several common video file formats in Windows Explorer. Download: Codec Tweak Tool 6.7.7 | 1.5 MB (Freeware) View: Codec Tweak Tool Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • The site is pretty sparse on features / tech specs. Can I plug it into a PC/hone/Switch via USB-C and use it as an external display? If so, what's the virtual resolution of the screen, the refresh rate, PPI of the image etc? Is the text crisp enough to use for coding at say 12pt? Is it good enough for playing dark games, like say Path of Exile 2? How about fast games like car racing games? Just how do they expect anyone to order this thing without giving out all this info?
  • Recent Achievements

    • One Month Later
      Vincian earned a badge
      One Month Later
    • First Post
      Jocimo earned a badge
      First Post
    • Week One Done
      suprememobiles48 earned a badge
      Week One Done
    • One Month Later
      Windows Guy earned a badge
      One Month Later
    • One Month Later
      Prasann earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      546
    2. 2
      +Edouard
      158
    3. 3
      PsYcHoKiLLa
      86
    4. 4
      neufuse
      65
    5. 5
      Steven P.
      65
  • Tell a friend

    Love Neowin? Tell a friend!