簡化設定的過程
寫得有點爛
能用就好(死
2009/12/11 重寫了一些部份(Button13)
Windows 7 和 Windows Server 2008R2 的圖片:
Public Class Form1 Dim regget(10) As String Dim regpath(5) As String Dim servicename(5) 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 0.3.4" GroupBox1.Text = "General" GroupBox2.Text = "Service" GroupBox3.Text = "General Setting" GroupBox4.Text = "Service Setting (Need Reboot)" 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" Button8.Text = "No Service" Button9.Text = "No Service" Button10.Text = "No Service" Button11.Text = "No Service" Button12.Text = "No Service" Button13.Text = "Refresh" Button14.Text = "Input" Button15.Text = "Input" Button16.Text = "Setting" Button17.Text = "Disable" Button18.Text = "Disable" Button19.Text = "" Button20.Text = "" Button21.Text = "No Service" Button22.Text = "No Service" Button23.Text = "No Service" Button24.Text = "No Service" Button25.Text = "No Service" Button26.Text = "Auto Setting" Label1.Text = "" Label2.Text = "" Label3.Text = "(Read ToolTip First)" Label4.Text = "" Label5.Text = "(Need Reboot)" Label6.Text = "" Label7.Text = "" Label8.Text = "(Start Mode)" Label9.Text = "(Click)" Label10.Text = "(Click)" Label11.Text = "No Service" Label12.Text = "No Service" Label13.Text = "No Service" Label14.Text = "No Service" Label15.Text = "No Service" Label16.Text = "(Read From WMI)" Label17.Text = "(Service State)" Label18.Text = "(Information)" TextBox8.Text = "No Service" TextBox9.Text = "No Service" TextBox10.Text = "No Service" TextBox11.Text = "No Service" TextBox12.Text = "No Service" TextBox13.Text = "Belldandy" TextBox14.Text = "Syaorin" 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.Button13.PerformClick() End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.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) servicename(0) = "WinDefend" servicename(1) = "MpsSvc" servicename(2) = "Themes" servicename(3) = "AudioSrv" servicename(4) = "wscsvc" 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 = "OK" Else TextBox3.Text = "Error" 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 For i = 0 To 4 Step 1 If My.Computer.Registry.GetValue _ (regpath(4) & "\" & servicename(i), _ "DisplayName", Nothing) Is Nothing Then Select Case servicename(i) Case servicename(0) Button21.Enabled = False Case servicename(1) Button22.Enabled = False Case servicename(2) Button23.Enabled = False Case servicename(3) Button24.Enabled = False Case servicename(4) Button25.Enabled = False End Select Else Select Case servicename(i) Case servicename(0) Dim WinDefend = objWMIService.Get _ ("Win32_Service.Name='WinDefend'") Button8.Text = WinDefend.DisplayName TextBox8.Text = WinDefend.StartMode Button21.Text = "Disable" Label11.Text = WinDefend.State() Case servicename(1) Dim MpsSvc = objWMIService.Get _ ("Win32_Service.Name='MpsSvc'") Button9.Text = MpsSvc.DisplayName TextBox9.Text = MpsSvc.StartMode Button22.Text = "Disable" Label12.Text = MpsSvc.State() Case servicename(2) Dim Themes = objWMIService.Get _ ("Win32_Service.Name='Themes'") Button10.Text = Themes.DisplayName TextBox10.Text = Themes.StartMode Button23.Text = "Auto" Label13.Text = Themes.State() Case servicename(3) Dim AudioSrv = objWMIService.Get _ ("Win32_Service.Name='AudioSrv'") Button11.Text = AudioSrv.DisplayName TextBox11.Text = AudioSrv.StartMode Button24.Text = "Auto" Label14.Text = AudioSrv.State() Case servicename(4) Dim wscsvc = objWMIService.Get _ ("Win32_Service.Name='wscsvc'") Button12.Text = wscsvc.DisplayName TextBox12.Text = wscsvc.StartMode Button25.Text = "Disable" Label15.Text = wscsvc.State End Select End If Next End Sub Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click My.Computer.Registry.SetValue _ (regpath(2), "DisableAutoplay", "1", Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click My.Computer.Registry.SetValue _ (regpath(3), "EnableLUA", "0", Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.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.Button13.PerformClick() End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click Dim RegisteredOwner As String RegisteredOwner = TextBox13.Text My.Computer.Registry.SetValue _ (regpath(0), "RegisteredOwner", RegisteredOwner, Microsoft.Win32.RegistryValueKind.String) Me.Button13.PerformClick() End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click Dim RegisteredOrganization As String RegisteredOrganization = TextBox14.Text My.Computer.Registry.SetValue _ (regpath(0), "RegisteredOrganization", RegisteredOrganization, Microsoft.Win32.RegistryValueKind.String) Me.Button13.PerformClick() End Sub Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click My.Computer.Registry.SetValue _ (regpath(4) & "\WinDefend", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click My.Computer.Registry.SetValue _ (regpath(4) & "\MpsSvc", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click My.Computer.Registry.SetValue _ (regpath(4) & "\Themes", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click My.Computer.Registry.SetValue _ (regpath(4) & "\AudioSrv", "Start", 2, Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button25_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button25.Click My.Computer.Registry.SetValue _ (regpath(4) & "\wscsvc", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord) Me.Button13.PerformClick() End Sub Private Sub Button26_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button26.Click Me.Button14.PerformClick() Me.Button15.PerformClick() Me.Button16.PerformClick() Me.Button17.PerformClick() Me.Button18.PerformClick() Me.Button21.PerformClick() Me.Button22.PerformClick() Me.Button23.PerformClick() Me.Button24.PerformClick() Me.Button25.PerformClick() End Sub End Class
OLD PICTURE:
0.3.2
0.3.1
0 件のコメント:
コメントを投稿