´ó·²ÈÈÁµÖеÄÍø³æ¶¼Ôø¾ÏÝÈëÏÂÁеÄÀ§¾³£ºÔ¼ºÃÅ®/ÄÐÅóÓÑÍíÆßµã°ëÔÚÀϵط½µÈ£¬È´ÔÚ¼ÆËã»úÃæÇ°Ò»Ö±ÅÀÐе½ÉîÒ¹£¬µÈ·´Ó³¹ýÀ´£¬ÅóÓÑÔçÒÑ·÷³¾¶øÈ¥£¬Óֵü¸ÌìµÄ¹¦·òÈ¥ÅãÀñµÀǸ¡£ÅóÓѺβ»°´ÒÔϲ½Öè×öÒ»¼òµ¥µÄÄÖÖÓ£¬ÈÃÄã°²°²ÐÄÐÄÉÏÍø£¬´ó´ó·½·½Ô¼»á¡£ÄãÖ»ÒªÔÚÉÏÍøµÄʱºò´ò¿ª´ËÓ¦ÓóÌÐò£¬ÉèÖúÃÔ¼»áʱ¼ä£¨µ±È»Ò²¿ÉÒÔÊÇĬÈϺõģ©¼´¿É¡£Ê±¼äÒ»µ½£¬ÒôÀÖÏìÆ𣬿ìÈ¥Ô¼»á°É¡£
±¾ÄÖÖÓ³ÌÐòÓÐÒÔÏÂ×é¼þ×é³É£º
ÐòºÅ ×é¼þÀàÐÍ ×é¼þÃû³Æ ¹¦ÄÜ
1 Tlabel l_Clock_1 ÏÔʾ¡°ÊäÈëÈÕÆÚ¡±
2 TdateTimePicker dtp_Clock_1 Ñ¡ÔñÈÕÆÚ
3 Tlabel l_Clock_2 ÏÔʾ¡°ÊäÈëʱ¼ä¡±
4 TdateTimePacker tdp_Clock_2 Ñ¡Ôñʱ¼ä
5 TmediaPlayer mp_Clock ÑÝ×àÒôÀÖ
6 Tbutton b_Clock_Open ÖØдò¿ª
7 Ttimer t_Clock ¶¨Ê±¼ì²â
8 Tbutton b_Clock_Close ¹Ø±ÕÓ¦ÓóÌÐò
ÆÁÄ»×é¼þÒ»ÀÀ±í
ÆÁÄ»×é¼þÒ»ÀÀͼ
˵Ã÷£ºdtp_Clock_1 µÄKindÊôÐÔÉèÖÃΪdtkDate £¬ dtp_Clock_2 µÄKindÊôÐÔÉèÖÃΪdtkTime£¬mp_Clock µÄFileNameÊôÐÔÉèÖÃΪÄãÖ÷»úÉÏ´æÔÚµÄÈκÎmid¡¢wav¡¢aviÎļþ¡£t_Clock µÄIntervalÊôÐÔÉèÖÃΪ10¡£
ʼþ˵Ã÷ÈçÏ£º
¢Ù¡¢ t_ClockµÄOnTimer :
{
//°´Ê±´¥·¢ÑÝʾ³ÌÐò
struct date d;
struct time t;
AnsiString thour,tmin,tsec;
int dyear;
int dintyear;
int dmon,dday;
AnsiString tinthour,tintmin,tintsec;
AnsiString dintmon,dintday;
//È¡µ±ÌìÈÕÆÚ
getdate(&d);
dyear=d.da_year;
dday=d.da_day;
dmon=d.da_mon;
dintyear=StrToInt(dint.SubString(1,2));
dintmon=dint.SubString(4,2);
dintday=dint.SubString(7,2);
//È¡µ±Ê±Ê±¼ä
gettime(&t);
thour=AnsiString(t.ti_hour);
tmin=AnsiString(t.ti_min);
//tsec=AnsiString(t.ti_sec);
//tint=AnsiString(DateTimePicker1- >Time);
tinthour=tint.SubString(10,2);
tintmin=tint.SubString(13,2);
//tintsec=tint.SubString(16,2);
//ÄÖÖÓ·þÎñ¹¦ÄÜ
if ((StrToInt(thour)==StrToInt(tinthour))&&
(StrToInt(tmin)==StrToInt(tintmin))
&&(StrToInt(AnsiString(dyear).SubString(3,2))
==dintyear)&&(StrToInt(dmon)==StrToInt(dintmon))
&&(StrToInt(dday)==StrToInt(dintday)))
{
dTimer- >Enabled=false;
MediaPlayer1- >Open();
MediaPlayer1- >Play();
}
}
¢Ú¡¢ b_Clock_Open µÄOnClick£º
{
t_Clock- >Enabled=true;
}
¢Û¡¢ b_Clock_CloseµÄOnClick
{
Application- >Terminate();
}
µ±È»´Ë³ÌÐò»¹¿ÉÒÔÍØÕ¹¡¢Ï¸»¯£¬ÈçÎÒ½ö½«´¥·¢Ìõ¼þ¼ì²âµ½·Ö£¬µ±È»ËüÍêÈ«¿ÉÒÔ¼ì²âµ½Ã룬Ҳ¿ÉÒÔ½ö¼ì²âµ½Ê±¡£