//每50分钟提醒一次,放卡农,弹出框,没有窗口,后台运行,采用多字节字符集
#include
<conio.h>
#include
<cstdlib>
#include
<windows.h>
#include
<process.h>//多线程支持
#pragma comment(lib, "WINMM.LIB")//playsound需要该库
#define
ONEHOUR
3600000//一小时
#define
FIFTYMINUTES
3000000
//50分钟
#define
TENMINUTES
600000//10分钟
#define
TESTTIME
300000//5分钟
unsigned int __stdcall PlayMusic(void * p);
unsigned long hThreadHandle;
unsigned uThreadID;
INT WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR lpCmdLine, INT nCmdShow)
{
MessageBox(NULL,"Begin!","Reminder",MB_OK);
for(int i = 0; i < 24; ++i){
Sleep(FIFTYMINUTES);
hThreadHandle = _beginthreadex(NULL,0,PlayMusic,0,0,&uThreadID);
MessageBox(NULL,"Have a rest!","Reminder",MB_OK);
}
return 0;
}
unsigned int __stdcall PlayMusic(void * p){
//char music[10];
//strcpy_s(music, "kanon.wav");
PlaySound(TEXT("kanon.wav"), NULL, SND_FILENAME|SND_SYNC);
return 0;
}