#include <Windows.h>
#include<iostream>
void CALLBACK TimerProc(HWND hwnd, UINT nmsg, UINT ntimerid, DWORD dwtime)
{
//具体要做的事
}
void init()//初始化窗体
{
//设置定时器
SetTimer(0, 0, sleep, &TimerProc);//参数 句柄,编号,时间,自定义函数名取地址
MSG msg;
while (GetMessage(&msg, NULL, 0, 0))//阻塞式,获取消息
{
if (msg.message == WM_TIMER)
{
DispatchMessage(&msg);//分发器,调用分发器系统才会调用回调函数
}
}
}