Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Microsoft.Win32;
- using System.IO;
- using System.Diagnostics;
- namespace Windows_7_Logon_Changer
- {
- public partial class Form1 : Form
- {
- public string fileName;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- lblHeight.Text = "Height: " + SystemInformation.PrimaryMonitorSize.Height.ToString();
- lblWidth.Text = "Width: " + SystemInformation.PrimaryMonitorSize.Width.ToString();
- this.Text = "Windows 7 Logon Changer - " + Environment.UserName;
- RegistryKey key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background");
- string check = Convert.ToString(key.GetValue("OEMBackground"));
- if (check == "0")
- {
- btnDisable.Enabled = false;
- btnDisable.Image = Windows_7_Logon_Changer.Properties.Resources.ye;
- btnDisable.ImageAlign = ContentAlignment.MiddleLeft;
- btnEnable.Enabled = true;
- btnEnable.Image = null;
- this.Width = 315;
- this.Height = 135;
- }
- else
- {
- btnEnable.Enabled = false;
- btnEnable.Image = Windows_7_Logon_Changer.Properties.Resources.ye;
- btnEnable.ImageAlign = ContentAlignment.MiddleLeft;
- btnDisable.Enabled = true;
- btnDisable.Image = null;
- this.Width = 614;
- this.Height = 528;
- pbBackground.ImageLocation = HDD1;
- }
- }
- private void btnEnable_Click(object sender, EventArgs e)
- {
- RegistryKey key = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background");
- key.SetValue("OEMBackground", 1);
- btnEnable.Enabled = false;
- btnEnable.Image = Windows_7_Logon_Changer.Properties.Resources.ye;
- btnEnable.ImageAlign = ContentAlignment.MiddleLeft;
- btnDisable.Enabled = true;
- btnDisable.Image = null;
- this.Width = 614;
- this.Height = 528;
- Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "") + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- }
- private void btnDisable_Click(object sender, EventArgs e)
- {
- RegistryKey key = Registry.LocalMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI\\Background");
- key.SetValue("OEMBackground", 0);
- btnDisable.Enabled = false;
- btnDisable.Image = Windows_7_Logon_Changer.Properties.Resources.ye;
- btnDisable.ImageAlign = ContentAlignment.MiddleLeft;
- btnEnable.Enabled = true;
- btnEnable.Image = null;
- this.Width = 315;
- this.Height = 135;
- }
- private void editInPaintToolStripMenuItem_Click(object sender, EventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- Image img = Image.FromFile(HDD1);
- img.Tag = HDD1;
- System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
- info.FileName = ("mspaint.exe");
- info.Arguments = img.Tag.ToString();
- System.Diagnostics.Process p1 = System.Diagnostics.Process.Start(info);
- }
- private void addToClipboardToolStripMenuItem_Click(object sender, EventArgs e)
- {
- Clipboard.SetImage(pbBackground.Image);
- }
- private void btnChooseImage_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Filter = "JPG Images (*.jpg)|*.jpg|JPEG Images (*.jpeg)|*.jpeg";
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- fileName = ofd.FileName;
- PictureBox pbImage = new PictureBox();
- pbImage.ImageLocation = fileName;
- int Height = pbImage.Height;
- int Width = pbImage.Width;
- FileInfo fi = new FileInfo(fileName);
- long fileSize = fi.Length;
- if (fileSize > 262144)
- {
- MessageBox.Show("The Image can't be above 256kb's!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
- return;
- }
- if (SystemInformation.PrimaryMonitorMaximizedWindowSize.Height > Height | SystemInformation.PrimaryMonitorMaximizedWindowSize.Width > Width)
- {
- if (MessageBox.Show("The Image is smaller than your screen! You can continue but it will be streched to fit your screen!" + Environment.NewLine + "Do you wish to continue?", "Error!", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.No)
- {
- return;
- }
- }
- btnNewImage.Enabled = true;
- MessageBox.Show("Click 'Apply New Image' To make it the default new background", "Next Step", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- private void btnNewImage_Click(object sender, EventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try
- {
- File.Delete(HDD1);
- }
- catch { }
- HDD1.Replace("\\backgroundDefault.jpg", "");
- try
- {
- File.Move(fileName, HDD1);
- }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- File.Move(fileName, HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void btnAbout_Click(object sender, EventArgs e)
- {
- MessageBox.Show("Coded By: Call Me Alexx (Alex Reed)" +
- Environment.NewLine +
- "Originaly Found By: (Can't find who)" +
- Environment.NewLine +
- "Researched/Worked Out By: Call Me Alexx" +
- Environment.NewLine +
- Environment.NewLine +
- "Thanks To:" +
- Environment.NewLine +
- "HaLo2FrEaK - Idea after he made his application" +
- Environment.NewLine +
- "Dark Slipstream - Showing i converted bytes to kilobytes wrong, XD" +
- Environment.NewLine +
- "Roxy - <3" +
- Environment.NewLine +
- Environment.NewLine +
- "Warning: This computer program is protected by international treaties. Blargy, Blargy, Blarg... Just don't be a gypsy and steal it or the sauce code. :)" +
- Environment.NewLine +
- "kthxbai. ;D",
- "Windows 7 Logon Changer - About",
- MessageBoxButtons.OK,
- MessageBoxIcon.Information);
- }
- private void btnSupImages_Click(object sender, EventArgs e)
- {
- if (tabControl1.Visible == false)
- {
- tabControl1.Visible = true;
- tabControl1.BringToFront();
- }
- else
- {
- tabControl1.Visible = false;
- tabControl1.SendToBack();
- }
- }
- private void pB1_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try { Windows_7_Logon_Changer.Properties.Resources.pB1.Save(HDD1); }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- Windows_7_Logon_Changer.Properties.Resources.pB1.Save(HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void pB2_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try { Windows_7_Logon_Changer.Properties.Resources.pB2.Save(HDD1); }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- Windows_7_Logon_Changer.Properties.Resources.pB2.Save(HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void tabControl1_Leave(object sender, EventArgs e)
- {
- tabControl1.Visible = false;
- tabControl1.SendToBack();
- }
- private void pB3_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try { Windows_7_Logon_Changer.Properties.Resources.pB3.Save(HDD1); }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- Windows_7_Logon_Changer.Properties.Resources.pB3.Save(HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void pB4_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try { Windows_7_Logon_Changer.Properties.Resources.pB4.Save(HDD1); }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- Windows_7_Logon_Changer.Properties.Resources.pB4.Save(HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void pB5_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try { Windows_7_Logon_Changer.Properties.Resources.pB5.Save(HDD1); }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- Windows_7_Logon_Changer.Properties.Resources.pB5.Save(HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- private void pB6_MouseDoubleClick(object sender, MouseEventArgs e)
- {
- string HDD = Environment.GetFolderPath(Environment.SpecialFolder.System).Replace("Windows\\system32", "");
- string HDD1 = HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\backgroundDefault.jpg";
- try { Windows_7_Logon_Changer.Properties.Resources.pB6.Save(HDD1); }
- catch
- {
- Directory.CreateDirectory(HDD + "Windows\\System32\\oobe\\Info\\backgrounds\\");
- Windows_7_Logon_Changer.Properties.Resources.pB6.Save(HDD1);
- }
- pbBackground.Image = null;
- pbBackground.ImageLocation = HDD1;
- MessageBox.Show("New Backgroup Image Added, Log Off or Switch User to View it!", "Done!", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment