jaberwacky Posted August 31, 2013 Share Posted August 31, 2013 (edited) 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. expandcollapse popup#AutoIt3Wrapper_Version=B #autoit3wrapper_jump_to_first_error=y #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_Run_Tidy=n 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) _main() Func _main() _AutoItObject_StartUp() Const $model = _model() Const $view = _view() $view.SetTitle($model.ProgramName) Const $monitor_count = $model.MonitorCount() Select 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.") Exit EndSelect $view.MoveX($view.GetXPosition()) $view.SetDesktopColor($model.DesktopColor()) $view.InitPicClicks($monitor_count) $view.UpdateStatus("Welcome.") $view.ShowNormal() Local $message = '' Do $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 Case $GUI_EVENT_CLOSE $view.UpdateStatus("Bye Bye!") _AutoItObject_Shutdown() Sleep(300) Exit Case $hb_append $view.UpdateStatus("Working...") Local $timer = TimerInit() $model.CreateWallpaper($monitor_count, $view.PicClicks) If @error Then Return SetError(1, @error, False) $model.SetWallpaperTile() $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 $model.SetDesktopColor($color) $view.SetDesktopColor($model.DesktopColor()) EndSwitch Case $gui_event_dropped For $pic_click In $view.PicClicks Switch @GUI_DropId Case $pic_click.PicClick $pic_click.Draw(@GUI_DragFile) ExitLoop EndSwitch Next 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 $pic_click.Draw($selected_image) EndSwitch ExitLoop EndSwitch Next EndSwitch Until False EndFunc Func _exit() Exit EndFunc Edited February 13, 2015 by jaberwacky FireFox 1 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
TheSaint Posted September 1, 2013 Share Posted September 1, 2013 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. Spoiler 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) Link to comment Share on other sites More sharing options...
jaberwacky Posted January 24, 2014 Author Share Posted January 24, 2014 Updated. Se op for details. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now