Jump to content
Sign in to follow this  

Multiple Wallpaper Images

Recommended Posts

For lack of a better name.

If you have multiple monitors then you may have wanted a different image to appear on each monitor.  This lets you do that.  This used to requre a third party program to work but now it's a stand alone.  I finally got around to figuring out various aspects of GDI+.  I never would have done it without the helpful people on this forum!

Requires the latest AutoIt beta. 

Only tested on Windows7 x64 on a two monitor setup.  If you have more than two then I require you to try this and tell me how it did.  Now!

[update: 01/24/2014] -- Now based on Model View Controller design pattern.  I did this to hopefully ease any future updates.  Also added a feature to change the desktop color.  Now images can be dropped onto the gui.  Also, uses GDI+ to resize and display the chosen images on the gui.  This is faster and looks better than GuiCtrlCreatePic.

[update: 01/17/2014] -- Now uses GDI+ to handle the resizing, etc!  Credit given to various people inside the script.

Here is the zip containing everything that is needed: Desktop Background Maker.zip

Downloads: 97

Known issue:  If you select your images and then change the desktop color this makes the images go blank on the gui.  Go figure.  I think it may be because the gui is repainted.  I tried to lock it and disable the gui but no joy.  Edit: Ok, the next version will remedy this.


Here is just the main code for those interested.





Opt("MustDeclareVars", 1)

#include "AutoItObject.au3"

#include "Error Handler.au3"

#include <Misc.au3>

#include <Model.au3>

#include <GUI.au3>

#include <View.au3>

HotKeySet("{ESC}", _exit)


Func _main()

  Const $model = _model()

  Const $view = _view()


  Const $monitor_count = $model.MonitorCount()

    Case $monitor_count > 2
      $view.ResizeWidth(($monitor_count * 205) + 10)
    Case $monitor_count < 2
      MsgBox($MB_TOPMOST, $model.ProgramName, "Two or more monitors are required.")





  Local $message = ''
    $message = GUIGetMsg()
    Switch $message
      Case 0, $gui_event_minimize, $gui_event_mousemove, $gui_event_primarydown, $gui_event_primaryup, _
           $gui_event_secondarydown, $gui_event_secondaryup, $gui_event_restore
        $view.UpdateStatus("Bye Bye!")
      Case $hb_append
        Local $timer = TimerInit()
        $model.CreateWallpaper($monitor_count, $view.PicClicks)

        If @error Then Return SetError(1, @error, False)


        $model.SetWallpaper(@ScriptDir & "\Desktop Background.jpg")
        FileDelete(@ScriptDir & "\Desktop Background.jpg")
        $view.UpdateStatus("Finished in " & Round(TimerDiff($timer) / 1000, 2) & " seconds.")
      Case $hb_desktop_color
        Local $color = _ChooseColor()
        Switch $color <> -1
          Case True
      Case $gui_event_dropped        
        For $pic_click In $view.PicClicks          
          Switch @GUI_DropId
            Case $pic_click.PicClick
      Case Else           
        For $pic_click In $view.PicClicks
          Switch $message
            Case $pic_click.PicClick
              Local $selected_image = $pic_click.SelectImage()
              Switch $selected_image <> False
                Case True                
  Until False

Func _exit()    
Edited by jaberwacky

Share this post

Link to post
Share on other sites

I just use the native Win functions for BMP and the command-line ability of IrfanView for JPG with my (single monitor) wallpaper changing program, but like you, have been meaning to use GDI.

IrfanView, if you aren't aware of it, is an excellent and versatile free program.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...