win32控制台如何制作定时器,注意是控制台,没有window之类的窗体,求,多谢!(最好贴点代码或小例子)

win32控制台怎么制作定时器,注意是控制台,没有window之类的窗体,急求,谢谢!!!(最好贴点代码或小例子)
RT

------解决方案--------------------
C/C++ code
#include "windows.h"
#include <stdio.h>

#include "Mmsystem.h"

#pragma comment( lib, "Winmm.lib" )

void WINAPI mycallback(UINT uTimerID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
    printf( "comming..\n" ); 
}


int main()
{
    MMRESULT mr = timeSetEvent( 1000,0,mycallback,0,TIME_CALLBACK_FUNCTION);
    
    MSG msg;
    
    while( GetMessage(&msg, NULL, 0, 0 ) )
    {
        ::TranslateMessage( &msg );
        ::DispatchMessage( &msg );
    }
    
    return 0;
}

------解决方案--------------------
C/C++ code
#include <stdio.h>
#include <windows.h>

DWORD WINAPI ThreadTimer(LPVOID lpParameter)
{
    Sleep(1000);
    
    return 1;
}

int main()
{
    while (1)
    {
        HANDLE hThread = CreateThread(NULL, 0, ThreadTimer, NULL, 0, NULL);
        WaitForSingleObject(hThread, INFINITE);
        printf("OnTimer\n");
        CloseHandle(hThread);    
    }    
    return 1;
}

------解决方案--------------------
在我机器编译通过了啊

C/C++ code
#include <stdio.h>
#include <windows.h>

DWORD WINAPI ThreadTimer(LPVOID lpParameter)
{
    Sleep(1000);
    
    return 1;
}

int main()
{
    while (1)
    {
        HANDLE hThread = CreateThread(NULL, 0, ThreadTimer, NULL, 0, NULL);
        WaitForSingleObject(hThread, INFINITE);
        SYSTEMTIME time;
        GetSystemTime(&time);
        printf("%02d:%03d\n", time.wSecond, time.wMilliseconds);
        CloseHandle(hThread);    
    }
    return 1;
}

------解决方案--------------------
在VC中编译OK
C/C++ code

#include "stdafx.h"
#include <STDIO.H>
#include <WINDOWS.H>

void CALLBACK TimerProc(HWND, UINT, UINT, DWORD)
{
    printf("%s\n\r", "abc");
}

void main()
{
    SetTimer(0, 0, 1000, &TimerProc);
    MSG msg = {0};
    while (GetMessage(&msg, NULL, 0, 0))
    {
        if (msg.message == WM_TIMER)
        {
            TranslateMessage(&msg);
            DispatchMessage(&msg);
        }
    }
}

------解决方案--------------------
windows不是有定时器的api么 用不就完了