When I use OnTimer() in Visual C++ 6.0 using MFC Library the application screen starts blinking(flashing). Is there any solution about this problem? Thanks.

Check the OnTimer event handler, maybe there is something that causes the window to be repainted.

Here is my code in WM_TIMER. Maybe you can tell me the reason i can't understand. Thanks in advance.

if(x+ballWidth >= rect.right)
{
    moveX = -moveX;
}
if(x<=0)
{
    moveX = -moveX;
}
if(y+ballWidth >= rect.bottom-50)
{
    moveY = -moveY;
}
if(y<=50)
{
    moveY = -moveY;
}

x+=moveX;
y+=moveY;

Invalidate(NULL);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.