cs_othland
Messages postés298Date d'inscriptionjeudi 18 décembre 2003StatutMembreDernière intervention 9 février 2010
-
6 avril 2006 à 11:11
sphaxslayer
Messages postés216Date d'inscriptionmardi 5 avril 2005StatutMembreDernière intervention17 septembre 2008
-
6 avril 2006 à 12:45
slt tlm,
je veux ajouter une portion de code qui surveille l'horloge système et qui déclanche une alrte sonore à une heure bien précise!
quelqu'un sait comment le faire???
sphaxslayer
Messages postés216Date d'inscriptionmardi 5 avril 2005StatutMembreDernière intervention17 septembre 2008 6 avril 2006 à 12:45
Salut,
ce code surveille le temps du systeme. Vois si tu peux pas t'en servir pour ta surveillance. En revanche, pour l'alerte sonore je ne sais pas du tout !
=======================================================
[DllImport("coredll.dll")]
private extern static void GetSystemTime(ref SYSTEMTIME lpSystemTime);
using System.
using System.Runtime.InteropServices;
using System.Windows.Forms
private struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
private void GetTime()
{
// Call the native GetSystemTime method
// with the defined structure.
SYSTEMTIME stime = new SYSTEMTIME();
GetSystemTime(ref stime);
// Show the current time.
MessageBox.Show("Current Time: " +
stime.wHour.ToString() + ":"
+ stime.wMinute.ToString());
}
private void SetTime()
{
// Call the native GetSystemTime method
// with the defined structure.
SYSTEMTIME systime = new SYSTEMTIME();
GetSystemTime(ref systime);
// Set the system clock ahead one hour.
systime.wHour = (ushort)(systime.wHour + 1 % 24);
SetSystemTime(ref systime);
MessageBox.Show("New time: " + systime.wHour.ToString() + ":"
+ systime.wMinute.ToString());
}
=======================================================
"Un seul Être vous manque, et tout est dépeuplé..."