I got win32 application, that runs a infinite for loop, which increment a value inside the loop. the problem am having is that my application become unresponsive and uses alot of CPU when compiled.

case IDM_ROTATION:

            for(int i = 0; i < 4; i++)
            {

                i = 0;

                rotation += rotationIncrement;
                InvalidateRect(hWnd, NULL, TRUE);
                UpdateWindow(hWnd);
            }

            break;

How can i fix this?, I just want a loop or timer that increment my rotation variable every second.

Why are you resetting i to 0?

add a timer control(timer1). set the interval property to 1000. put your code, from the for loop, inside the timer1 tick event. to start the timer call timer1.start, to stop it call timer1.stop.

@tinstaafl ,thanks for the help, it worked :)

you're very welcome. please remember to mark this solved. thx

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.