[VB.net] Lancer un programme au démarrage de windows

    Publicités

Users Who Are Viewing This Thread (Total: 0, Members: 0, Guests: 0)

Apr 26, 2011
1,315
2
944
26
In my home
Discord
brokeos
Salut, donc on va commencer directement :

Créez un nouveau projet, faite un désigne rapide et rajouter un openfiledialog :

986290671.png


Double cliquez sur le bouton parcourir :

Code:
Dim result = ofd_file.ShowDialog 'sert à ouvrir l'openfiledialog et à récupérer le résultat de fermeture
If result = Windows.Forms.DialogResult.OK Then
txt_file.Text = ofd_file.FileName
End If

Puis sur le bouton valider :

Code:
If txt_key.Text = "" Or txt_file.Text = "" Then
MsgBox("Remplissez tout les champs !", MsgBoxStyle.Exclamation)
Else
Dim Registry As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser
Dim Key As Microsoft.Win32.RegistryKey = Registry.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True)
Key.SetValue(txt_key.Text, txt_file.Text, Microsoft.Win32.RegistryValueKind.String)
MsgBox("Ajouter !", MsgBoxStyle.Information)
End If

Petite explication :

Registry.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Run", True) est la clef qui dit a windows de lancer l'application écrite avec le Key.SetValue()

Final :

752868972.png


Déboguer, et voila !

450863823.png


Si vous voulez supprimez la clef : Key.DeleteValue()
 
Last edited:

Lord Nol

Nouveau membre
Sep 13, 2014
1
0
61
22
je n'arrive pas a creer un mail bomber pleazzzzz help me peut etre en videos please