其实就是 Windows 消息循环

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//消息循环
GetMessage(&msg, NULL, NULL, NULL); //初始化msg
while( msg.message != WM_QUIT )
{
if( PeekMessage( &msg, NULL, 0, 0 , PM_REMOVE) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
else
{
tNow = GetTickCount();
if(tNow - tPre >= 40)
MyPaint(hdc);
}
}
1
tPre = GetTickCount();