您的位置:首页 > 其它

重温WIN32 API ------ SetTimer()无窗口调用方式

2014-12-25 20:43 344 查看
#include <stdio.h> 
#include <windows.h> 

#define  IDT_TIMER  100

void CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT_PTR idEvent,DWORD dwTime)
{
 SYSTEMTIME st;

 GetLocalTime(&st);
    printf("%2d:%2d:%2d.%3d hello!/n", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
}

int main(int argc, char* argv[])
{

    int iret = SetTimer(NULL, IDT_TIMER, 1000, (TIMERPROC)TimerProc);

    MSG msg;
    while (1) 
    {
        GetMessage(&msg, NULL, 0, 0);
        DispatchMessage(&msg);        
    }    
   return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: