locked
Setting resolution-dependent wallpaper - Stuck on transcoding wallpaper RRS feed

  • General discussion

  • Dear sirs,

    I happen to manage a Windows 7 corporate environment with a mix of resolution ratios (16:9 8:5 and 4:3).

    Management departments do not accept the idea of distorted text in user wallpapers, which are all set with a corporate .theme but they also provide the corporate wallpaper which has the text on the lower right corner, which makes impossible to use only one wallpaper for all resolutions or ratios, as would happen with a wallpaper whose text was on the upper left corner.

    I need at least one different wallpaper per aspect ratio (accounting for old 4:3 screens, new HD 16:9 screens and laptop 8:5 / 16:9 screens). No problem with scaling to lower resolutions within the same aspect ratio.

    I've come up with the following startup script, which checks resolution and copies the appropriate-aspect wallpaper into the folder %windir%\Web\Wallpapers\Corporate as img1337.jpg which is referenced in the corporate .theme already configured. And it works like a charm (the aspect detection and copying thing):

    strComputer = "."
    
    'find out resolution with WMI
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery ("Select * From Win32_DisplayConfiguration")
    For Each objItem in colItems
    currentRes = objItem.PelsWidth & "x" & objItem.PelsHeight
    Next
    Dim Ratio
    
    'define aspect ratio based on resolution
    If currentRes = "1920x1080" Or currentRes = "1600x900" Or currentRes = "1280x720" Then
    Ratio = "16-9"	
    elseif currentRes = "2048x1280" Or currentRes = "1920x1200" Or currentRes = "1680×1050" Or currentRes = "1440x900" Or currentRes = "1280×800" Or currentRes = "1150×720" Or currentRes = "1024×640" Then
    Ratio = "8-5"
    else
    Ratio = "4-3"
    end if
    
    'copy from C:\Windows\Web\WPifratio either ratio-4-3.jpg, ratio-8-5.jpg or ratio-16-9.jpg to wallpaper img1337.jpg
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.CopyFile "C:\Windows\Web\WPifratio\ratio-" & Ratio & ".jpg", "C:\Windows\Web\Wallpapers\Corporate\img1337.jpg", True
    Set fso = Nothing

    The problem:

    This sets, but does not update. Even rebooting does not update.

    Windows 7 gets its user wallpaper from regkey HKCU\Control Panel\Desktop\Wallpaper and it always points to C:\Users\<user name>\AppData\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg

    This comes from HKCU\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper Source and at some point right after changing the wallpaper this latter key gets updated, then some process is called to update/transcode the newly-set wallpaper into said filesystem location.

    I've been told to also copy to TranscodedWallpaper.jpg but I'd really like to be able to cast that process into transcoding and updating as it should.

    INB4... RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters does not invoque the transcoding, it does reapply changed registry settings so the same transcodedwallpaper.jpg will be reapplied, meaning no change at all. Already been down that road.

    Thanks in advance. I hope this script helps people, at least to the point where I got stuck. I'm pretty sure I'm only one step away from achieving this!

    Ast3citos


    • Edited by Ast3citos Tuesday, November 27, 2012 1:39 PM
    • Changed type Juke Chou Friday, December 7, 2012 8:31 AM
    Tuesday, November 27, 2012 1:37 PM

All replies

  • Hi,

    Thanks for sharing. We really appreciate your time and efforts. Hope your experience will help other community members facing similar problems.

    Regards.


    Spencer

    TechNet Community Support

    Wednesday, November 28, 2012 2:25 AM
  • Hi everyone,

    Though I was confident people could benefit of all the work I did and the workarounds I guessed to my situation I also was expecting a little help in the wallpaper transcoding thing. Actually, I did not manage to solve this yet.

    I need someone to point me in the right direction, that is, the process which does the transcoding of the newly set wallpaper into %appdata%\Roaming\Microsoft\Windows\Themes\TranscodedWallpaper.jpg

    Thanks for reading!

    Ast3citos


    • Edited by Ast3citos Sunday, December 2, 2012 12:24 AM
    Sunday, December 2, 2012 12:24 AM
  • Hi,

    For Windows Script issue, I would like suggest you post it to here for further help:

    http://social.technet.microsoft.com/Forums/en/category/scripting

    Thanks for your understanding.


    Spencer

    TechNet Community Support

    Monday, December 3, 2012 1:40 AM