最简单的定时器
// sin01.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <math.h> #include <Windows.h> void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime ); int _tmain(int argc, _TCHAR* argv[]) { SetTimer(NULL,1,500,(TIMERPROC)TimerProc); MSG msg; while (1) { GetMessage(&msg, NULL, 0, 0); DispatchMessage(&msg); } return 0; } void CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT idEvent, DWORD dwTime) { double d=sin(120.0); printf("%0d\n",d); }

浙公网安备 33010602011771号