Bonjour à tous,

Je travaille actuellement sur l'installation d'un de mes programmes. Comme ce programme doit se lancer avec le système et ne pas être fermé par l'utilisateur (Il reste dans la barre des taches), je dois le fermer automatiquement lors de l'installation d'une mise à jour ou de la désinstallation.

J'arrive déjà à lancer mon application à la fin de l'installation via la classe Installer mais impossible de fermer l'application automatiquement... Voici le code de ma classe installer :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
Imports System
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.Collections
Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.Reflection
Imports System.IO
 
<RunInstaller(True)> _
Public Class InstallerClass
    Inherits System.Configuration.Install.Installer
 
    Public Sub New()
        MyBase.New()
        AddHandler Me.Committed, AddressOf MyInstaller_Committed
        AddHandler Me.Committing, AddressOf MyInstaller_Committing
        AddHandler Me.BeforeUninstall, AddressOf MyInstaller_BeforeUninstall
        AddHandler Me.BeforeInstall, AddressOf MyInstaller_BeforeInstall
    End Sub
 
    Private Sub MyInstaller_Committing(ByVal sender As Object, ByVal e As InstallEventArgs)
    End Sub
 
    Private Sub MyInstaller_Committed(ByVal sender As Object, ByVal e As InstallEventArgs)
        Try
            Directory.SetCurrentDirectory(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
            Process.Start(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\SupportThalie.exe")
        Catch
        End Try
    End Sub
 
    Private Sub MyInstaller_BeforeInstall(ByVal sender As Object, ByVal e As InstallEventArgs)
        StopSupport()
    End Sub
 
    Private Sub MyInstaller_BeforeUninstall(ByVal sender As Object, ByVal e As InstallEventArgs)
        StopSupport()
    End Sub
 
    Private Sub StopSupport()
        Try
            Dim proc() As Process
            Dim i As Integer
 
            proc = Process.GetProcesses()
            For i = 0 To proc.Count
                If proc(i).MainWindowTitle.Contains("Support") Then
                    proc(i).Kill()
                End If
            Next
        Catch ex As Exception
        End Try
    End Sub
 
    Public Overloads Overrides Sub Install(ByVal savedState As IDictionary)
        MyBase.Install(savedState)
    End Sub
 
    Public Overloads Overrides Sub Commit(ByVal savedState As IDictionary)
        MyBase.Commit(savedState)
    End Sub
 
    Public Overloads Overrides Sub Rollback(ByVal savedState As IDictionary)
        MyBase.Rollback(savedState)
    End Sub
End Class
J'ai bien mis les actions personnalisées dans mon projet de déploiement. Si quelqu'un à une idée... je suis preneur...

Merci à tous.