Customize the Windows 7 logon background with C#

Due to the frustration of not having shared or even written any code for a while, I went home last night and coded this little application. It’s trivial, but kind of fun.

Update: And tonight, 5th June 2013, I added the Photoshopped monitor images to the GUI, based on my two Samsung 20B300B monitors in front of me at home. Yes, the screen shot below now overlaps the bar on the right, but I like it like that. I had a look at the contents of the driver disk that came with each monitor, and ironically my monitor image looks better than the one in their installation software (except that I took the liberty of giving the monitor a 4:3 aspect ratio so that the logon background images would fit perfectly – actual aspect ratio is 16:9). Anyway, drawing stuff with Photoshop is very easy, and my PSD file is in the images directory of the source archive. It could be used to make an icon or something… Just change the logo text – Mine says “Romy”, which is a nickname for “Jerome”.

Download the application:
Download the source code:


Using the application

Note that this application needs to be run as administrator, or run from an account with administrative permissions, because it is modifying a global system setting. The logon background image is common to all Windows users.

Once the application is extracted and the Custom Background checkbox is checked, all you need to do is select one of the images and click the Apply button.

The application has an images directory. Add any jpg files smaller than 256kB there, and you can use those images as well. (The 256kB size limit is imposed by Windows. This application checks the size of the files in its images directory, and ignores any image files that are over the limit. It doesn’t prompt you if any files are too large, because that prompt would then be displayed every time the application is run. This paragraph is the only place this behaviour is documented.) The default images are just modified copies of the original logon background image.

What it does

If you’re comfortable making changes to the registry, you don’t need an application to do this. The setting is enabled in Windows by adding the registry DWORD value and setting it to 1: SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background\OEMBackground

Then the image needs to be copied to: Windows\System32\oobe\info\backgrounds\backgrounddefault.jpg

The images

Here’s a better view of what my modified images look like. As stated, all three were created by modifying the default logon background image. The crimson and yellow image below was done with Photoshop, while the other two were done by applying image filters in my RomyView application (which references the AForge.Net Image manipulation library).




When I investigated how to do this a couple of weeks ago, I was surprised to find many comments on the tutorial pages, by various people expressing their disappointment regarding the 256kB size limit. My images are saved with 90% quality and sure, they are only 1024×768, but that’s good enough, and easily fits inside the limit.

If you are in that camp, that is, you do not know how to save a jpeg image of reasonable quality at reasonable size, or are unable to find out, then regretfully, I have some bad news for you:

God does make mistakes sometimes. On the day of your conception, He’d had one too many communions with the Holy Spirit. He misplaced a couple of unborn souls, and Lo and Behold… Let there be shite! You were created as a human. You were supposed to be a donkey. Bet fret not, it can easily be fixed by a bullet to the head.

Yes, I’m bored. Sorry.


About Jerome

I am a senior C# developer in Johannesburg, South Africa. I am also a recovering addict, who spent nearly eight years using methamphetamine. I write on my recovery blog about my lessons learned and sometimes give advice to others who have made similar mistakes, often from my viewpoint as an atheist, and I also write some C# programming articles on my programming blog.
This entry was posted in Programming and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s