倒计时器代码!求高人指点!看看!
SYSTEMTIME systime;
GetSystemTime(&systime);
// GetLocalTime(&systime);//获取本地时间
// sprintf(buf, "%d:%d:%d", systime.wHour,systime.wMinute,systime.wSecond);
// SetTimer(hWnd,1,1000,NULL);
// MessageBox(hWnd,"定时器设置成功","ok",MB_OK);
// buf = systime.wHour;
char buf[11];
char destRs[20];
hdc = GetDC(hWnd);
int year=0;
int month=0;
int day=0;
int hour=0;
int min=0;
int sec=20;
for(;sec >=0; --sec){
/* buf1[sec] = i;*/
/* GetTimeFormat(NULL,0,NULL, L"00':'00':'i", buf1, sizeof(buf1));
TextOut(hdc,100,100,buf,sizeof(buf1));*/
sprintf(destRs,"%4d-%2d-%2d %2d:%2d:%2d",year,month,day,hour,min,sec);
TextOut(hdc,100,100,destRs,sizeof(destRs));
SetTimer(hWnd,1,1000,NULL);
}
GetTimeFormat(LOCALE_USER_DEFAULT,0,&systime, "hh':'mm':'ss", buf, sizeof(buf));
TextOut(hdc,50,50,buf,sizeof(buf));
ReleaseDC(hWnd,hdc);
}
}
break;