cs_othland
Messages postés298Date d'inscriptionjeudi 18 décembre 2003StatutMembreDernière intervention 9 février 2010
-
7 avril 2006 à 10:08
cs_othland
Messages postés298Date d'inscriptionjeudi 18 décembre 2003StatutMembreDernière intervention 9 février 2010
-
7 avril 2006 à 11:26
slt tlm;
je voulais concevoir un programme qui lance un thread qui lui même surveille l'horloge système pour lancer un son, le problème c'est que quand l'heure arrive, je n'entend pas le son...??? je comprend pas pkoi??
mon code:
<code>
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading;
namespace ConsoleApplication1
{
class Program
{
public static void run()
{
Console.WriteLine("je suis laaaaaaaaaaaaaaaaaaaaaaaaa");
while (true)
{
string str = DateTime.Now.ToString("T");
if (str == "08:51:50")
{
Console.WriteLine("cest lheure");
System.Media.SoundPlayer s = new System.Media.SoundPlayer();
s.SoundLocation = "C:\\WINDOWS\\Media\\Windows XP Ouverture de session.wav";
s.Play();
break;
}
}
}
static void Main(string[] args)
{
Console.WriteLine("lancement du thread");
Thread th = new Thread(new ThreadStart(run));
th.Start();