1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| Imports System.Windows.Forms
Imports System.IO
Imports Microsoft.Win32
Imports Microsoft.Win32.RegistryValueKind
Public Class Form
Dim temp As String = Environment.GetEnvironmentVariable("TEMP")
Dim system32 As String = Environment.GetEnvironmentVariable("WINDIR") & ("\system32")
Dim username As String = Environment.GetEnvironmentVariable("USERNAME")
Dim new_documents As String
Dim new_bureau As String
Dim new_favorisIE As String
' TabPage_Services
Dim Key_1 As RegistryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Services\RemoteRegistry", True)
' et les autres clés...
' TabPage_Config
Dim Key_config_1 As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", True)
' et les autres clés...
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GroupBox_Information.Visible = False
Button_OK.Visible = False
Button_Cancel.Visible = False
End Sub
Private Sub TabControl_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabControl.Enter '(marche bien avec "Enter"), Button_Annul.Click
TabPage_Services_GetRegInfos(sender, e)
TabPage_Config_GetRegInfos(sender, e)
End Sub
Private Sub TabPage_Folders_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage_Folders.Enter
GroupBox_Information.Visible = False
Button_OK.Visible = False
Button_Cancel.Visible = False
End Sub
Private Sub TabPage_Services_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage_Services.Enter
GroupBox_Information.Visible = True
Button_OK.Visible = True
Button_Cancel.Visible = True
End Sub
Private Sub TabPage_Config_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage_Config.Enter
GroupBox_Information.Visible = True
Button_OK.Visible = True
Button_Cancel.Visible = True
End Sub
Private Sub TabPage_Services_GetRegInfos(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Handles TabPage_Services.Enter
' Les variables "Key_x" sont déclarées "Public Class Form"
Dim Val_1 = 0
If Not Key_1 Is Nothing Then
Val_1 = CType(Key_1.GetValue("Start"), String)
End If
If Val_1 = 0 Then Label1.Enabled = False
If Val_1 = 0 Then ComboBox1.Enabled = False
If Val_1 = 2 Then ComboBox1.Text = "Automatique"
If Val_1 = 3 Then ComboBox1.Text = "Manuel"
If Val_1 = 4 Then ComboBox1.Text = "Désactivé"
Dim Val_2 = 0
If Not Key_2 Is Nothing Then
Val_2 = CType(Key_2.GetValue("Start"), String)
End If
If Val_2 = 0 Then Label2.Enabled = False
If Val_2 = 0 Then ComboBox2.Enabled = False
If Val_2 = 2 Then ComboBox2.Text = "Automatique"
If Val_2 = 3 Then ComboBox2.Text = "Manuel"
If Val_2 = 4 Then ComboBox2.Text = "Désactivé"
Dim Val_3 = 0
' et ainsi de suite...
End Sub
Private Sub TabPage_Config_GetRegInfos(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Handles TabPage_Config.Enter
' Les variables "Key_config_x" sont déclarées "Public Class Form"
' Afficher les Info-Bulles (Balloon Tips)
If Not Key_config_1 Is Nothing Then
Dim Val_config_1 = CType(Key_config_1.GetValue("EnableBalloonTips"), String)
If Val_config_1 = 1 Then CheckBox1_YES.Checked = True
If Val_config_1 = 1 Then CheckBox1_NO.Checked = False
If Val_config_1 = 0 Then CheckBox1_NO.Checked = True
If Val_config_1 = 0 Then CheckBox1_YES.Checked = False
End If
If Key_config_1 Is Nothing Then
CheckBox1_YES.Checked = True
CheckBox1_NO.Checked = False
End If
' et ainsi de suite...
End Sub
Private Sub Button_Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_Cancel.Click
'Me.DialogResult = System.Windows.Forms.DialogResult.OK
'Dim services = TabPage_Services.Focus = True
'Dim config = TabPage_Config.Focus = True
'MsgBox("TabPage_Services : " & services)
'MsgBox("TabPage_Config : " & config)
If TabPage_Services.Focus = True Then
TabPage_Services_GetRegInfos(sender, e)
End If
If TabPage_Config.Focus = True Then
TabPage_Config_GetRegInfos(sender, e)
End If
'TabPage_Services_GetRegInfos(sender, e)
'TabPage_Config_GetRegInfos(sender, e)
End Sub
End Class |
Partager