Simple Logon Screen Changer Using WPF and VB.Net


Posted Date:     Total Responses: 0    Posted By: Hefin Dsouza   Member Level: Gold   Points/Cash: 10   


MadXp's Logon Screen Changer


This is an Application which can change your default Logon Screen of Windows XP. There are many applications that allow you to do this Application's like Logon Studio etc.

I have developed this simple application in WPF using Vb.Net. You can see how i made it by following the description below. The Application does Not use any DLL's nor does it use any API so it is very easy to understand.

Selecting The Logon Screen


The logon Screen is an Exe file so in the OpenFileDialog I Added a Filter that will only show EXE Files.

The below given code will Allow the OpenFileDialog to only show Exe Files and once a file is selected it will add that filename to a ListBox and also check that the File is not already present in the ListBox.

Private Sub Add_One(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click
Dim open As New OpenFileDialog()
open.Filter = "Logon Files(*.exe)|*.exe|All Files(*.*)|*.*"
If open.ShowDialog() = True Then
Dim fileName As String
fileName = open.FileName
Dim it As String = fileName.Remove(0, fileName.LastIndexOf("\") + 1)
If LogonList.Items.Contains(it) = False Then
LogonList.Items.Add(it)
path = open.FileName.Replace(it, "")
Button3.IsEnabled = True
Button2.IsEnabled = True
Else
MessageBox.Show(it & " Already Exist")
End If
Else
End If
End Sub

Changing the Image in the picture box to show preview of the seleted Logon Screen


The code below will allow you to see preview of the selected Logon Screen when the user selects it
from the ListBox.

Private Sub LogonList_SelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles LogonList.SelectionChanged
Dim bmp As New BitmapImage()
Try
bmp.BeginInit()
bmp.StreamSource = New FileStream(path & LogonList.SelectedValue.ToString().Replace("exe", "jpg"), FileMode.Open)
Catch ex As Exception
bmp.StreamSource = New FileStream(Application.ResourceAssembly.Location.Replace("LogonChanger.exe", "Na.jpg"), FileMode.Open)
ErrMess.Content = "To get a Preview Save an .JPG Image with the Same Name as of the Logon in the Same Folder. Example:logon.exe must also have logon.jpg"
Finally
bmp.EndInit()
Image1.Source = bmp
Image1.UpdateLayout()
End Try
TextBox1.Text = path & LogonList.SelectedValue.ToString()
End Sub

Changing The Logn Screen


The Logon screen is changed using an Registry Entry in

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon ====> UIHOST is the value that changes the Logon Screen

I have Written this code on the Apply Seleted Button

My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon", True).SetValue("UIHost", TextBox1.Text)

The TextBox1.Text holds the path to the selected Logon Screen

Restoring The Logon Screen To Default


Now it was very important to restore the logon screen back to Windows default in case you dont like the logon screens
So for setting the Logon Screen back to default i add This code to the Restore Back To Default button

My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon", True).SetValue("UIHost", "logonui.exe")

For testing how your Logon Screen Looks


Now it was very irritating for me to keep on logging off and seeing the Logon Screen So i used the Switch User Method.
Now you can also use this method in the form of an Button Click in VB.Net
For Switch Users and Quick Testing the Logon Screen i used this code on the TEST Button

Process.Start("rundll32.exe", "user32.dll,LockWorkStation")

The Following code was used to Switch Users Function.

Conclusion :

I tried my level best to make it simple for you to understand the logic behind this application.if you still face any difficulties please feel free to contact me.

For Those who want to edit this project :

I have some upgrade plans also so please contact me with your suggestions.

Regards Hefin Dsouza

Attachments




Screen Shots
  • Download The Full Application with Source Code (463-22259-LogonChanger.rar)

  • Project Feedbacks

    Author: Member Level: SilverRevenue Score: 1 out of 5
    project file is missing ..pls post that file


    Author: Member Level: GoldRevenue Score: 2 out of 52 out of 5
    To Run This Project you need to Have
    Visual Studio 2008 Service Pack 1
    And .Net Framework 3.5 Service Pack 1

    To Modify the Application you will also require
    Expression Blend 2 Service Pack 1


    Author: Member Level: GoldRevenue Score: 1 out of 5
    Hi,
    I really liked this work.Thanks alot...


    Author: Member Level: GoldRevenue Score: 2 out of 52 out of 5
    Hi,
    Its really nice. I would like learn such type of things.

    It will be greatful for me to send the files.

    Thanks Rakesh,
    Siva Sreenath


    Author: Member Level: GoldRevenue Score: 1 out of 5
    Dude your Application is not working check it out.


    Author: Member Level: GoldRevenue Score: 2 out of 52 out of 5
    Good Work. This is a good example of tweaking window registry and modifying windows system file. Hope such apps in future too.

    Regards
    Shailesh Pisat


    Post Feedback
    You must Sign In to post a feedback.
    Next Project: Mp3 Player in WPF using DirectX Dll's
    Previous Project: WinCalculator

    Return to Project Index

    Post New Project


    Related Projects


    Top Contributors
    TodayLast 7 Daysmore...

    Awards & Gifts
     
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India