[VB.NET] Lancer un programme dans un programme par {my.Resources}

iUNeIV

CryptoMineur
Premium
Inscription
25 Novembre 2012
Messages
1 485
Réactions
283
Points
20 534
Yo,

Avec la recherche du fonctionnement sous VB.Net, pour lancer un programme qui se retrouve dans les valeurs "Resources"

Code:
Dim tempFilePath As String = Path.Combine(Path.GetTempPath(), "internet.exe")
 
        Try
            ' Écrire les octets de la ressource dans un fichier temporaire
            System.IO.File.WriteAllBytes(tempFilePath, My.Resources.Internet)
 
            ' Vérifier si le fichier temporaire existe
            If System.IO.File.Exists(tempFilePath) Then
                ' Lancer le programme exécutable depuis le fichier temporaire
                Process.Start(tempFilePath)
            Else
                ' Gérer le cas où le fichier temporaire n'existe pas
                MessageBox.Show("Erreur: Le fichier temporaire n'existe pas.")
            End If
        Catch ex As Exception
            ' Gérer l'erreur lors de l'écriture du fichier temporaire
            MessageBox.Show("Erreur: " & ex.Message)
        End Try
 
Haut