NoFear

导航

WIN32弹窗报时间【CSDN】

Posted on 2012-02-08 12:38  Fear_Hao  阅读(371)  评论(0编辑  收藏  举报
View Code
#pragma comment(lib,"user32")
#include <windows.h>
#include <time.h>
char HHMM[6];
time_t t;
int i,r;
int main()
{
while (1)
{
for (i=0;i<10;i++)
Sleep(1000);
time(&t);
strftime(HHMM,6,"%H:%M",localtime(&t));
if (IDCANCEL==MessageBox(NULL,HHMM,"Time",MB_OKCANCEL|MB_SETFOREGROUND))
break;
}
return 0;
}