Bonjour,

J'ai développé un applicatif avec un écran de démarrage multi thread.

Celui fonctionne très bien sur mon Pc.

Mais quand je l'ai essayé sur un autre pc de configuration différente les instructions de mon écran s'exécute bien mais je ne vois pas l'affichage de cette écran de démarrage et j'ai aucun message d'erreur, l'écran principal de mon programme qui suit l'écran de démarrage s'affiche bien.

Voici le code:

Program.vb:

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
 
Imports System.Threading
 
 
Namespace SplashScreenThreaded
	Friend NotInheritable Class Program
 
		Private Sub New()
		End Sub
 
		''' <summary>
        ''' Le point d'entrée principal de l'application.
		''' </summary>
		<STAThread> _
		Shared Sub Main()
			Application.EnableVisualStyles()
			Application.SetCompatibleTextRenderingDefault(False)
			Application.Run(New MainForm())
		End Sub
	End Class
End Namespace
SplashScreem.vb

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.ComponentModel
Imports System.Text
 
Namespace SplashScreenThreaded
	''' <summary>
    ''' Type de messages: Success/Warning/Error.
	''' </summary>
	Public Enum TypeOfMessage
		Success
		Warning
		[Error]
	End Enum
	''' <summary>
    ''' Initier instance de SplashScreen
	''' </summary>
	Public NotInheritable Class SplashScreen
 
        Public Sub New()
        End Sub
		Private Shared sf As SplashScreenForm = Nothing
 
		''' <summary>
        ''' Affichage du splashscreen
		''' </summary>
		Public Shared Sub ShowSplashScreen()
			If sf Is Nothing Then
				sf = New SplashScreenForm()
				sf.ShowSplashScreen()
			End If
		End Sub
 
		''' <summary>
        ''' Fermeture SplashScreen
		''' </summary>
		Public Shared Sub CloseSplashScreen()
			If sf IsNot Nothing Then
				sf.CloseSplashScreen()
				sf = Nothing
			End If
		End Sub
 
		''' <summary>
        ''' Mise à jour du texte dans la couleur verte par défaut de message de réussite
		''' </summary>
		''' <param name="Text">Message</param>
		Public Shared Sub UdpateStatusText(ByVal Text As String)
			If sf IsNot Nothing Then
				sf.UdpateStatusText(Text)
			End If
 
		End Sub
 
		''' <summary>
        ''' Mise à jour du texte avec un message défini comme couleur vert / jaune / rouge / pour le succès / avertissement / échec
		''' </summary>
		''' <param name="Text">Message</param>
        ''' <param name="tom">Type du messagee</param>
		Public Shared Sub UdpateStatusTextWithStatus(ByVal Text As String, ByVal tom As TypeOfMessage)
 
			If sf IsNot Nothing Then
				sf.UdpateStatusTextWithStatus(Text, tom)
			End If
		End Sub
	End Class
 
End Namespace
SplashScreenForm

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
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
 
Imports System.ComponentModel
Imports System.Text
 
Namespace SplashScreenThreaded
	Partial Public Class SplashScreenForm
		Inherits Form
 
		Private Delegate Sub StringParameterDelegate(ByVal Text As String)
		Private Delegate Sub StringParameterWithStatusDelegate(ByVal Text As String, ByVal tom As TypeOfMessage)
		Private Delegate Sub SplashShowCloseDelegate()
 
		''' <summary>
        ''' Pour assurer écran de démarrage est fermé à l'aide de l'API et non par le clavier ou toutes autres choses
		''' </summary>
		Private CloseSplashScreenFlag As Boolean = False
 
		''' <summary>
		''' Base constructor
		''' </summary>
		Public Sub New()
			InitializeComponent()
            Me.LblInfo.Parent = Me.pictureBox1
            Me.LblInfo.BackColor = Color.Transparent
            LblInfo.ForeColor = Color.Green
            progressBar1.Show()
        End Sub
 
        ''' <summary>
        ''' Affiche le splashscreen
        ''' </summary>
        Public Sub ShowSplashScreen()
            If InvokeRequired Then
                ' Nous ne sommes pas dans le thread d'interface utilisateur, nous avons donc besoin de faire appel BeginInvoke
                BeginInvoke(New SplashShowCloseDelegate(AddressOf ShowSplashScreen))
                Return
            End If
            Me.Show()
            Application.Run(Me)
        End Sub
 
        ''' <summary>
        ''' Ferme le SplashScreen
        ''' </summary>
        Public Sub CloseSplashScreen()
            If InvokeRequired Then
                BeginInvoke(New SplashShowCloseDelegate(AddressOf CloseSplashScreen))
                Return
            End If
            CloseSplashScreenFlag = True
            Me.Close()
        End Sub
 
        ''' <summary>
        ''' Mise à jour du texte dans la couleur verte par défaut de message de réussite
        ''' </summary>
        ''' <param name="Text">Message</param>
        Public Sub UdpateStatusText(ByVal Text As String)
            If InvokeRequired Then
                BeginInvoke(New StringParameterDelegate(AddressOf UdpateStatusText), New Object() {Text})
                Return
            End If
            LblInfo.ForeColor = Color.Green
            LblInfo.Text = Text
        End Sub
 
 
        ''' <summary>
        ''' Mise à jour du texte avec un message défini comme couleur vert / jaune / rouge / pour le succès / avertissement / échec
        ''' </summary>
        ''' <param name="Text">Message</param>
        ''' <param name="tom">Ty</param>
        Public Sub UdpateStatusTextWithStatus(ByVal Text As String, ByVal tom As TypeOfMessage)
            If InvokeRequired Then
                BeginInvoke(New StringParameterWithStatusDelegate(AddressOf UdpateStatusTextWithStatus), New Object() {Text, tom})
                Return
            End If
            Select Case tom
                Case TypeOfMessage.Error
                    LblInfo.ForeColor = Color.Red
                Case TypeOfMessage.Warning
                    LblInfo.ForeColor = Color.Yellow
                Case TypeOfMessage.Success
                    LblInfo.ForeColor = Color.Green
            End Select
            LblInfo.Text = Text
 
        End Sub
 
		''' <summary>
        ''' Empêche la fermeture de forme autre que en appelant la fonction CloseSplashScreen
		''' </summary>
		''' <param name="sender"></param>
		''' <param name="e"></param>
		Private Sub SplashForm_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing
			If CloseSplashScreenFlag = False Then
				e.Cancel = True
			End If
		End Sub
 
    End Class
End Namespace
Dans le load de mon Formulaire principal:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
                Call PROC_VERIF_INSTANCE()
                Call PROC_SUPPR_DOSSIER()
                conn.Open()
                SplashScreen.UdpateStatusTextWithStatus("Connexion réussie.", TypeOfMessage.Success)
                Thread.Sleep(3000)
                SplashScreen.UdpateStatusTextWithStatus("Mise à jour des statuts des candidatures.", TypeOfMessage.Success)
                Call PROC_MAJ_STATUT_CANDIDATURE()
                Thread.Sleep(3000)
                Me.Show()
                SplashScreen.CloseSplashScreen()
                Me.Activate()
                NotifyIcon1.Icon = My.Resources.Boss
                Me.WindowState = FormWindowState.Maximized
D'avance merci pour votre aide