最简单的定时器

// 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);

}

 

posted @ 2017-11-21 17:03  微笑的''80  阅读(133)  评论(0)    收藏  举报