0

i have a project to do and i dont know how to do it. please help me

how i can change the windows 7 login screen and shutdown screen using VB.NET

please help me

i found this
http://www.howtogeek.com/112110/

but i want to make it in vb.net

i also found below codes

Imports System.IO
Imports Microsoft.Win32

Public Class Form1
    Dim bgfile, systemdir As String


    Sub Apply()
        Try
            bgfile = btnBrowse.Text
            If bgfile = "" Then
                MsgBox("You have not selected a JPG image file", MsgBoxStyle.Information, "Error")
                Exit Sub
            End If
            Registry.SetValue("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionAuthenticationLogonUIBackground", "OEMBackground", 1, Microsoft.Win32.RegistryValueKind.DWord)
            If Not Directory.Exists(systemdir + "oobeinfo") Then
                Directory.CreateDirectory(systemdir + "oobeinfo")
                Directory.CreateDirectory(systemdir + "oobeinfobackgrounds")
            Else
                If Not Directory.Exists(systemdir + "oobeinfobackgrounds") Then
                    Directory.CreateDirectory(systemdir + "oobeinfobackgrounds")
                End If
            End If

            File.Copy(bgfile, systemdir + "oobeinfobackgroundsbackgroundDefault.jpg", True)

            MsgBox("LogonUI background changed successfully", MsgBoxStyle.OkOnly, "Successfully")
        Catch ex As Exception
            MsgBox("Failed" + vbCrLf + ex.Message, MsgBoxStyle.Exclamation, "Failed")
            Restore()
        End Try
    End Sub

    Sub Restore()
        Try
            Registry.SetValue("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionAuthenticationLogonUIBackground", "OEMBackground", 0, Microsoft.Win32.RegistryValueKind.DWord)
            If Directory.Exists(systemdir + "oobeinfo") Then
                Directory.Delete(systemdir + "oobeinfo", True)
            End If

            MsgBox("LogonUI background restored successfully", MsgBoxStyle.OkOnly, "Successfully")
        Catch ex As Exception
            MsgBox("Restore failed" + vbCrLf + ex.Message, MsgBoxStyle.Exclamation, "Restore failed")
        End Try
    End Sub




    Private Sub dlgOpen_FileOk_1(sender As System.Object, e As System.ComponentModel.CancelEventArgs) Handles dlgOpen.FileOk
        bgfile = dlgOpen.FileName
        'Check
        Dim inf As New FileInfo(bgfile)

        If Not inf.Exists Then
            MsgBox("File does not exist", MsgBoxStyle.Information, "Error")
            GoTo wrong
        End If

        If inf.Extension <> ".jpg" Then
            MsgBox("This is not a JPG image file", MsgBoxStyle.Information, "Error")
            GoTo wrong
        End If


        If inf.Length > 256000 Then
            MsgBox("The file size is bigger than 250 KB", MsgBoxStyle.Information, "Error")
            GoTo wrong
        End If

        'Set
        txtBGFile.Text = bgfile
        Exit Sub
wrong:
        bgfile = ""
        txtBGFile.Text = ""
        Exit Sub
    End Sub

    Private Sub btnBrowse_Click_1(sender As System.Object, e As System.EventArgs) Handles btnBrowse.Click
        dlgOpen.ShowDialog()
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        If My.Computer.Info.OSFullName.IndexOf("Windows 7", StringComparison.CurrentCultureIgnoreCase) = -1 Then
            MsgBox("This program must be run in Windows 7", MsgBoxStyle.Information, "Error")
            End
        End If
        systemdir = Environment.GetEnvironmentVariable("windir") + "system32"
    End Sub

    Private Sub btnApply_Click_1(sender As System.Object, e As System.EventArgs) Handles btnApply.Click
        Apply()
    End Sub

    Private Sub btnRestore_Click_1(sender As System.Object, e As System.EventArgs) Handles btnRestore.Click
        Restore()
    End Sub

    Private Sub txtBGFile_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtBGFile.TextChanged

    End Sub
End Class

but when i change background it gives error that unable to edit the registery path.access denied.

Edited by OMER AHMED: additional codes

1
Contributor
1
Reply
16
Views
2 Years
Discussion Span
Last Post by OMER AHMED
0

if i run above code as administrator then it will run but it not making any folder nor entering anything in registery...please check and help

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.