Windows Processing 100%

BlitzMax Forums/BlitzMax Programming/Windows Processing 100%

MarkAM(Posted 2006) [#1]
I've noticed that if you craete a standard loop for an applications e.g.

While not KeyDown(KEY_ESCAPE)
......
Wend

In windows, its runs as fast as possible (i.e. Utilising available processing power 100%). I can see this is usesfull for games but is there a way of contolling this for desktop apps?

I've tried using PollSystem() inside the loop but it seems to have no affect.


CS_TBL(Posted 2006) [#2]
use events.. that's how the native OS works..


xlsior(Posted 2006) [#3]
In windows, its runs as fast as possible (i.e. Utilising available processing power 100%). I can see this is usesfull for games but is there a way of contolling this for desktop apps?


Quick-and-dirty fix is to use delay:

delay 5

and CPU usage should drop to near 0. Larger delays should drop the CPU requirements even further, but the larger the number the longer it takes for the application to notice it when you do press a key as well.