Jump to content

Change background colour


Recommended Posts

Hello,

Is there any way in AutoIT3 that I can remove the background wallpaper and replace it with a fixed colour?

I know how to change the background picture - but can't seem to switch it off.

In GUI?

Link to comment
Share on other sites

In GUI?

Ummm, I dont understand. I've written a GUI tool to allow users to choose a background from a pre-determined folder (using a system tray dynamic menu). I'd like to avoid using the GD addon, so i'm currently using this function to change the wallpaper (modified from an example I saw on here earlier)....

Func _ChangeWallpaper($bmpfile, $iposition = "3")
    Switch $iPosition
        Case 1; Tile
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '1')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 2; Center
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 3; Stretch
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
    EndSwitch
    RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $bmpfile)
    DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $bmpfile, "int", 0)
EndFunc

This works perfectly, but I also want to offer the choice to have just a plain coloured background - so what im looking to do is to switch off the wallpaper and choose a background colour.

Link to comment
Share on other sites

Ummm, I dont understand. I've written a GUI tool to allow users to choose a background from a pre-determined folder (using a system tray dynamic menu). I'd like to avoid using the GD addon, so i'm currently using this function to change the wallpaper (modified from an example I saw on here earlier)....

Func _ChangeWallpaper($bmpfile, $iposition = "3")
    Switch $iPosition
        Case 1; Tile
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '1')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 2; Center
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '0')
        Case 3; Stretch
            RegWrite('HKCU\Control Panel\Desktop', 'TileWallpaper', 'reg_sz', '0')
            RegWrite('HKCU\Control Panel\Desktop', 'WallpaperStyle', 'reg_sz', '2')
    EndSwitch
    RegWrite('HKCU\Control Panel\Desktop', 'Wallpaper', 'reg_sz', $bmpfile)
    DllCall("user32", "int", "SystemParametersInfo", "int", 20, "int", 0, "str", $bmpfile, "int", 0)
EndFunc

This works perfectly, but I also want to offer the choice to have just a plain coloured background - so what im looking to do is to switch off the wallpaper and choose a background colour.

Set the wallpaper to an empty string. In 'HKCU\Control Panel\Colors set Background to the RGB colour you want.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...