Home > Software engineering >  Win32 with custom animation to create and how to close the form?
Win32 with custom animation to create and how to close the form?

Time:04-30

Not much said, the code
 
MoveWindow (hWnd, 1000, 400, 320, 104, 0).
//Sleep (83);
MoveWindow (hWnd, 1000-66, 400, 320, 104, 0).
//Sleep (83);
MoveWindow (hWnd, 1000-81, 400, 320, 104, 0).
//Sleep (83);
MoveWindow (hWnd, 1000-91, 400, 320, 104, 0).
//Sleep (83);
MoveWindow (hWnd, 1000-99, 400, 320, 104, 0).
//Sleep (83);
MoveWindow (hWnd, 1000-106, 400, 320, 104, 0).
//Sleep (83);
MoveWindow (hWnd, 1000-111, 400, 320, 104, 0).

I'm going to use 1 seconds (30 FPS), which is approximately equal to 83 milliseconds a frame rate of the animation is played,
This is the first few frames, left behind some of the shows. Believes that the code issues a look at it came out, Sleep to form blocked, no play, the final result is animation delay directly at (889400) shows, how to solve this problem?
Don't use AnimateWindow, thank you

CodePudding user response:

When waiting for distributing news
 
Void _Sleep_ (UINT Delay_ms)
{
DWORD dwTick=GetTickCount () + Delay_ms;
While (GetTickCount () & lt; DwTick)
{
MSG MSG.
If (PeekMessage (& amp; MSG, NULL, 0, 0, PM_REMOVE))
{
If (MSG) message==WM_QUIT) break;
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
Sleep (0);
}
}


CodePudding user response:

reference 1st floor zgl7903 response:
wait when distributing news
 
Void _Sleep_ (UINT Delay_ms)
{
DWORD dwTick=GetTickCount () + Delay_ms;
While (GetTickCount () & lt; DwTick)
{
MSG MSG.
If (PeekMessage (& amp; MSG, NULL, 0, 0, PM_REMOVE))
{
If (MSG) message==WM_QUIT) break;
TranslateMessage (& amp; MSG);
DispatchMessage (& amp; MSG);
}
Sleep (0);
}
}


Is ok, but how to realize in the window, please create the play?
  • Related