2009年12月27日日曜日

Check & Setting Tool (CST) 0.3.6.2

練習寫TABPAGE所以就分成2頁了XD


設定後(一般)

設定後(服務,有關Windows Search)

設定前(一般)

設定前(服務)

下載點:
http://amgbelldandy.myweb.hinet.net/cst.zip (0.3.6.2)
SHA1:e219ed74e41eeb318363911617e5deb3486aafc8
請小心食用(?

Public Class Form1
    Dim regget(10) As String
    Dim regpath(5) As String
    Dim servicename(6) As String
    Dim strComputer = "."
    Dim objWMIService = GetObject("winmgmts:\\" & strComputer)
    Dim colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "Check & Setting Tool"

        TabPage1.Text = "General"
        TabPage2.Text = "Service"

        GroupBox1.Text = "Name"
        GroupBox2.Text = "Name"
        GroupBox3.Text = "Setting"
        GroupBox4.Text = "Setting (Need Reboot)"

        ComboBox4.Items.Add("Disable")
        ComboBox4.Items.Add("Enable")
        ComboBox5.Items.Add("Disable")
        ComboBox5.Items.Add("Enable")
        ComboBox51.Items.Add("Disabled")
        ComboBox51.Items.Add("Auto")
        ComboBox52.Items.Add("Disabled")
        ComboBox52.Items.Add("Auto")
        ComboBox53.Items.Add("Disabled")
        ComboBox53.Items.Add("Auto")
        ComboBox54.Items.Add("Disabled")
        ComboBox54.Items.Add("Auto")
        ComboBox55.Items.Add("Disabled")
        ComboBox55.Items.Add("Auto")
        ComboBox56.Items.Add("Disabled")
        ComboBox56.Items.Add("Auto")

        Button1.Text = "RegisteredOwner"
        Button2.Text = "RegisteredOrganization"
        Button3.Text = "Folder Option Settings"
        Button4.Text = "AutoPlay"
        Button5.Text = "User Account Control"
        Button6.Text = "ComputerName"
        Button7.Text = "ComputerWorkgroup"
        Button11.Text = "Input"
        Button12.Text = "Input"
        Button13.Text = "Setting"
        Button14.Text = ComboBox4.Text
        Button15.Text = ComboBox5.Text
        Button16.Text = ""
        Button17.Text = ""
        Button51.Text = "No Service"
        Button52.Text = "No Service"
        Button53.Text = "No Service"
        Button54.Text = "No Service"
        Button55.Text = "No Service"
        Button56.Text = "No Service"
        Button101.Text = "Refresh"
        Button102.Text = "Setting All"
        Button103.Text = "Default"

        Label1.Text = ""
        Label2.Text = ""
        Label3.Text = "(Read ToolTip First)"
        Label4.Text = ""
        Label5.Text = "(Need Reboot)"
        Label6.Text = ""
        Label7.Text = ""
        Label51.Text = "No Service"
        Label52.Text = "No Service"
        Label53.Text = "No Service"
        Label54.Text = "No Service"
        Label55.Text = "No Service"
        Label56.Text = "No Service"
        Label101.Text = "(Information)"
        Label102.Text = "(ServiceName)"
        Label103.Text = "(Option)"
        Label104.Text = "(ServiceStartMode)"
        Label105.Text = "(ServiceState)"
        Label106.Text = "(Option)"
        Label150.Text = "Version 0.3.6.2"

        RadioButton1.Text = "On"
        RadioButton2.Text = "Off"

        TextBox51.Text = "No Service"
        TextBox52.Text = "No Service"
        TextBox53.Text = "No Service"
        TextBox54.Text = "No Service"
        TextBox55.Text = "No Service"
        TextBox56.Text = "No Service"

        regpath(0) = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
        regpath(1) = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
        regpath(2) = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers"
        regpath(3) = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
        regpath(4) = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services"

        Me.Button101.PerformClick()
        Me.Button103.PerformClick()
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button101.Click
        regget(0) = My.Computer.Registry.GetValue _
                    (regpath(0), "RegisteredOwner", Nothing)
        regget(1) = My.Computer.Registry.GetValue _
                    (regpath(0), "RegisteredOrganization", Nothing)
        regget(2) = My.Computer.Registry.GetValue _
                    (regpath(1), "Hidden", Nothing)
        regget(3) = My.Computer.Registry.GetValue _
                    (regpath(1), "HideFileExt", Nothing)
        regget(4) = My.Computer.Registry.GetValue _
                    (regpath(1), "ShowSuperHidden", Nothing)
        regget(5) = My.Computer.Registry.GetValue _
                    (regpath(1), "SeparateProcess", Nothing)
        regget(6) = My.Computer.Registry.GetValue _
                    (regpath(1), "ShowCompColor", Nothing)
        regget(7) = My.Computer.Registry.GetValue _
                    (regpath(1), "SharingWizardOn", Nothing)
        regget(8) = My.Computer.Registry.GetValue _
                    (regpath(2), "DisableAutoplay", Nothing)
        regget(9) = My.Computer.Registry.GetValue _
                    (regpath(3), "EnableLUA", Nothing)

        TextBox1.Text = regget(0)
        TextBox2.Text = regget(1)

        If regget(2) = 1 And _
           regget(3) = 0 And _
           regget(4) = 1 And _
           regget(5) = 1 And _
           regget(6) = 0 And _
           regget(7) = 0 Then
            TextBox3.Text = "Default Setting"
        Else
            TextBox3.Text = "User Setting"
        End If

        If regget(8) = 1 Then
            TextBox4.Text = "Disabled"
        Else
            TextBox4.Text = "Enabled"
        End If

        If regget(9) = 0 Then
            TextBox5.Text = "Disabled"
        Else
            TextBox5.Text = "Enabled"
        End If

        For Each objComputer In colSettings
            TextBox6.Text = objComputer.Name
            TextBox7.Text = objComputer.Workgroup
        Next

        servicename(0) = "WinDefend"
        servicename(1) = "MpsSvc"
        servicename(2) = "Themes"
        servicename(3) = "AudioSrv"
        servicename(4) = "wscsvc"
        servicename(5) = "WSearch"
        For i = 0 To 5 Step 1
            If My.Computer.Registry.GetValue _
               (regpath(4) & "\" & servicename(i), _
               "DisplayName", Nothing) Is Nothing Then
                Select Case servicename(i)
                    Case servicename(0)
                        Button61.Visible = False
                        ComboBox51.Visible = False
                    Case servicename(1)
                        Button62.Visible = False
                        ComboBox52.Visible = False
                    Case servicename(2)
                        Button63.Visible = False
                        ComboBox53.Visible = False
                    Case servicename(3)
                        Button64.Visible = False
                        ComboBox54.Visible = False
                    Case servicename(4)
                        Button65.Visible = False
                        ComboBox55.Visible = False
                    Case servicename(5)
                        Button66.Visible = False
                        ComboBox56.Visible = False
                End Select
            Else
                Select Case servicename(i)
                    Case servicename(0)
                        Dim WinDefend = objWMIService.Get _
                        ("Win32_Service.Name='WinDefend'")
                        Button51.Text = WinDefend.DisplayName
                        TextBox51.Text = WinDefend.StartMode
                        Button61.Text = ComboBox51.Text
                        Label51.Text = WinDefend.State()
                    Case servicename(1)
                        Dim MpsSvc = objWMIService.Get _
                        ("Win32_Service.Name='MpsSvc'")
                        Button52.Text = MpsSvc.DisplayName
                        TextBox52.Text = MpsSvc.StartMode
                        Button62.Text = ComboBox52.Text
                        Label52.Text = MpsSvc.State()
                    Case servicename(2)
                        Dim Themes = objWMIService.Get _
                        ("Win32_Service.Name='Themes'")
                        Button53.Text = Themes.DisplayName
                        TextBox53.Text = Themes.StartMode
                        Button63.Text = ComboBox53.Text
                        Label53.Text = Themes.State()
                    Case servicename(3)
                        Dim AudioSrv = objWMIService.Get _
                        ("Win32_Service.Name='AudioSrv'")
                        Button54.Text = AudioSrv.DisplayName
                        TextBox54.Text = AudioSrv.StartMode
                        Button64.Text = ComboBox54.Text
                        Label54.Text = AudioSrv.State()
                    Case servicename(4)
                        Dim wscsvc = objWMIService.Get _
                        ("Win32_Service.Name='wscsvc'")
                        Button55.Text = wscsvc.DisplayName
                        TextBox55.Text = wscsvc.StartMode
                        Button65.Text = ComboBox55.Text
                        Label55.Text = wscsvc.State
                    Case servicename(5)
                        Dim WSearch = objWMIService.Get _
                        ("Win32_Service.Name='WSearch'")
                        Button56.Text = WSearch.DisplayName
                        TextBox56.Text = WSearch.StartMode
                        Button66.Text = ComboBox56.Text
                        Label56.Text = WSearch.State
                End Select
            End If
        Next
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        If ComboBox4.SelectedIndex = 0 Then
            My.Computer.Registry.SetValue _
            (regpath(2), "DisableAutoplay", "1", Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(2), "DisableAutoplay", "0", Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        If ComboBox5.SelectedIndex = 0 Then
            My.Computer.Registry.SetValue _
            (regpath(3), "EnableLUA", "0", Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(3), "EnableLUA", "1", Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
        My.Computer.Registry.SetValue _
        (regpath(1), "Hidden", "1", Microsoft.Win32.RegistryValueKind.DWord)
        My.Computer.Registry.SetValue _
        (regpath(1), "HideFileExt", "0", Microsoft.Win32.RegistryValueKind.DWord)
        My.Computer.Registry.SetValue _
        (regpath(1), "ShowSuperHidden", "1", Microsoft.Win32.RegistryValueKind.DWord)
        My.Computer.Registry.SetValue _
        (regpath(1), "SeparateProcess", "1", Microsoft.Win32.RegistryValueKind.DWord)
        My.Computer.Registry.SetValue _
        (regpath(1), "ShowCompColor", "0", Microsoft.Win32.RegistryValueKind.DWord)
        My.Computer.Registry.SetValue _
        (regpath(1), "SharingWizardOn", "0", Microsoft.Win32.RegistryValueKind.DWord)
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        Dim RegisteredOwner As String
        RegisteredOwner = TextBox11.Text
        My.Computer.Registry.SetValue _
        (regpath(0), "RegisteredOwner", RegisteredOwner, Microsoft.Win32.RegistryValueKind.String)
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        Dim RegisteredOrganization As String
        RegisteredOrganization = TextBox12.Text
        My.Computer.Registry.SetValue _
        (regpath(0), "RegisteredOrganization", RegisteredOrganization, Microsoft.Win32.RegistryValueKind.String)
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button61.Click
        If ComboBox51.SelectedIndex = 0 Then
            My.Computer.Registry.SetValue _
            (regpath(4) & "\WinDefend", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(4) & "\WinDefend", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button62.Click
        If ComboBox52.SelectedIndex = 0 Then
            My.Computer.Registry.SetValue _
            (regpath(4) & "\MpsSvc", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(4) & "\MpsSvc", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button63.Click
        If ComboBox53.SelectedIndex = 1 Then
            My.Computer.Registry.SetValue _
            (regpath(4) & "\Themes", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(4) & "\Themes", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button64.Click
        If ComboBox54.SelectedIndex = 1 Then
            My.Computer.Registry.SetValue _
            (regpath(4) & "\AudioSrv", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(4) & "\AudioSrv", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button65.Click
        If ComboBox55.SelectedIndex = 0 Then
            My.Computer.Registry.SetValue _
            (regpath(4) & "\wscsvc", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(4) & "\wscsvc", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button102.Click
        Me.TabControl1.SelectedTab = TabPage1
        Me.Button11.PerformClick()
        Me.Button12.PerformClick()
        Me.Button13.PerformClick()
        Me.Button14.PerformClick()
        Me.Button15.PerformClick()
        Me.TabControl1.SelectedTab = TabPage2
        Me.Button61.PerformClick()
        Me.Button62.PerformClick()
        Me.Button63.PerformClick()
        Me.Button64.PerformClick()
        Me.Button65.PerformClick()
        Me.Button66.PerformClick()
        Me.TabControl1.SelectedTab = TabPage1
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox4.SelectedIndexChanged
        Button14.Text = ComboBox4.Text
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox5.SelectedIndexChanged
        Button15.Text = ComboBox5.Text
    End Sub

    Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox51.SelectedIndexChanged
        Button61.Text = ComboBox51.Text
    End Sub

    Private Sub ComboBox4_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox52.SelectedIndexChanged
        Button62.Text = ComboBox52.Text
    End Sub

    Private Sub ComboBox5_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox53.SelectedIndexChanged
        Button63.Text = ComboBox53.Text
    End Sub

    Private Sub ComboBox6_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox54.SelectedIndexChanged
        Button64.Text = ComboBox54.Text
    End Sub

    Private Sub ComboBox7_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox55.SelectedIndexChanged
        Button65.Text = ComboBox55.Text
    End Sub

    Private Sub Button28_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button103.Click
        TextBox11.Text = "Belldandy"
        TextBox12.Text = "Syaorin"
        ComboBox4.SelectedIndex = 0
        ComboBox5.SelectedIndex = 0
        ComboBox51.SelectedIndex = 0
        ComboBox52.SelectedIndex = 0
        ComboBox53.SelectedIndex = 1
        ComboBox54.SelectedIndex = 1
        ComboBox55.SelectedIndex = 0
        ComboBox56.SelectedIndex = 1
        RadioButton1.Checked = True
    End Sub

    Private Sub Button66_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button66.Click
        If ComboBox56.SelectedIndex = 1 Then
            My.Computer.Registry.SetValue _
            (regpath(4) & "\WSearch", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord)
        Else
            My.Computer.Registry.SetValue _
            (regpath(4) & "\WSearch", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord)
        End If
        Me.Button101.PerformClick()
    End Sub

    Private Sub ComboBox56_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox56.SelectedIndexChanged
        Button66.Text = ComboBox56.Text
    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        Button13.Enabled = True
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        Button13.Enabled = False
    End Sub
End Class

0 件のコメント: