• 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

    • I just looked on my computer and there are settings and log files for utilities I have never even turned on!
    • O&O ShutUp10 3.1.1104 by Razvan Serea O&O ShutUp10 offers a simple yet effective way to take control of your Windows privacy. It provides access to almost 50 privacy-related tweaks, most of them hidden or not easily accessible to the average computer users. Using a very simple interface, you decide how Windows 10/11 should respect your privacy by deciding which unwanted functions should be deactivated. Using ShutUp10 you can easily disable Windows Defender, turn off telemetry, disable peer-to-peer updates, turn off Wi-Fi Sense, disable automatic Windows updates, turn off and reset Cortana and more. ShutUp10 allows you to create a System Restore point before you apply any changes, so that you can revert your system at any time if you run into problems. O&O ShutUp10 is entirely free and does not have to be installed – it can be simply run directly and immediately on your PC. And it will not install or download retrospectively unwanted or unnecessary software, like so many other programs do these days! O&O ShutUp10 Free and Premium The latest version brings O&O ShutUp10 Premium, expanding the app’s long-standing privacy controls with automatic enforcement of user-defined settings. Instead of manually rechecking options after every Windows update, users can set their preferred privacy configuration once—or apply recommended settings in a single click—and the tool continuously monitors them in the background. If Windows 10 or 11 re-enables disabled features or introduces new data collection paths, Premium restores the chosen settings automatically without user intervention. The free version remains available and fully functional for manual adjustments, offering the same core privacy controls for Windows. However, the Premium tier is aimed at users who want long-term, hands-off protection, adding automatic reapplication after updates, ongoing monitoring, and optional notifications to ensure privacy settings remain consistent over time. O&O ShutUp10 3.1.1104 changelog: Added “Show Differences” button in the overview panel “Don’t show again” option for the restore point prompt Ctrl+F keyboard shortcut for search/filter functionality Detection and linking of system-wide and user-specific setting associations Automatic search while typing PREM: Option to preserve notification counters and timestamps across application restarts PREM: Reset blocked settings button in the Settings dialog PREM: Informational message when no settings are blocked PREM: Update check can also be triggered from the menu PREM: Notification deduplication and activity log summary feature Improved L005 “Disable Windows Location Service”: Version-specific split (up to Windows 11 23H2) and new variant for Windows 11 24H2+ L001 (Disable Location): Added Night Light warning to the description in all languages Search now detects setting IDs even when ID display is disabled and offers to enable it Detection and removal of Copilot/AI desktop apps in RecallTerminator Optimized High DPI support PREM: Reset button is now only enabled when blocked items exist – setting IDs are shown in the confirmation dialog PREM: Updated tray icons with higher-resolution versions PREM: Activity Log timestamps now use localized date and time formats PREM: Tray icon status now uses OK/Warning indicators and localized tooltips PREM: Recall folder detection switched to service-based detection PREM: Copilot uninstallation now provides UI feedback and improved verification Fixed Description text was not displayed correctly for the last item and disappeared when clicking the scrollbar Crash when clicking a search result heading or the […] button PREM: Installation path is now correctly preserved during upgrades PREM: Tray icon was not reliably removed when exiting the application PREM: Main window was not displayed correctly in single-instance mode PREM: Incorrect display of the & symbol in tray icon tooltips on Windows 10 PREM: Fixed notification flooding after sleep/standby PREM: Dashboard was not refreshed after applying recommended settings during onboarding PREM: Progress bar was not reset after deleting Recall folders PREM: Fixed service startup failures PREM: Fixed incorrect drift detection when Automatic Protection was disabled PREM: Notifications now correctly count all deviating settings when protection is enabled PREM: Registration Wizard was shown after sleep/standby despite a valid license Download: O&O ShutUp10 3.1.1104 | 76.4 MB (Freeware) Download: O&O ShutUp10 32-bit | ARM64 View: O&O ShutUp10 Home Page | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Fascinating...W h i t e P o w e r is now also asterisks out.  
    • In the past few days I have noticed two odd moderation activities. First, when I posted the term 'White Nationist Christian' it was asterisk's out. When I changed it to **** it was allowed! Second, in the Politics is a ###business thread I was allowed to post that the GOP is a party of p e d ophiles but I was censored  when I posted the GOP are a party of p e d ophile protectors. Wtf Neowin. Please explain.
  • 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
      165
    3. 3
      PsYcHoKiLLa
      86
    4. 4
      Steven P.
      66
    5. 5
      ATLien_0
      64
  • Tell a friend

    Love Neowin? Tell a friend!