slt tlm;
c'est la première fois que je travaille avec des thread sous visual C#.
j'ai un programme qui gère plusieurs fenêtres...etc.
je veux qu'en parallèle avec toutes mes fenêtres, je lance un thread qui surveille l'horloge système, j'ai placer mon thread dans program.cs mais ça n'a pas marché!!!!
mon code:

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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
 
namespace WindowsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        ///////////////////////////////
        public static void run()
        {
            //Console.WriteLine("je suis laaaaaaaaaaaaaaaaaaaaaaaaa");
            while (true)
            {
                string str = DateTime.Now.ToString("T");
                if (str == "10:38:50")
                {
                    MessageBox.Show("cest lheure");
                    System.Media.SoundPlayer s = new System.Media.SoundPlayer();
                    s.SoundLocation = "C:\\WINDOWS\\Media\\ringin.wav";
 
                    s.PlaySync();
 
                    break;
                }
 
            }
        }
 
            ///////////////////////////
 
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Thread th = new Thread(new ThreadStart(run));
            th.Start();
            Application.Run(new Form1());
 
 
        }
    }
}

que dois je faire???
je n'ai absolument aucune idée!!!