Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionIf Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "EventManager", "Erreur") = "Erreur" Then Microsoft.Win32.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "EventManager", Application.StartupPath & "\EventManager.exe") End If
If Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "MonApplication", "Erreur") = "Erreur" Then 'Si elle n'existe pas, on la créé Dim RegKey As Microsoft.Win32.RegistryKey 'On ouvre les droits d'écriture dans la base de registre RegKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", True) 'On créé notre clé avec comme nom "MonApplication" et comme valeur notre chemin COMPLET vers l'application RegKey.SetValue("MonApplication", My.Application.Info.DirectoryPath & "\MonApplication.exe") 'On ferme les droits d'écriture RegKey.Close() 'On réinitialise notre variable RegKey = Nothing End If