Hi All,
I have written an application in VB, which runs a constant timer to keep track of various events. Basically what happens is when the application is started a function is called from the Form_Initialize event to start the timer. The timer is in an infinite loop of the following format:
Do
DoEvents ' to allow user to exit
' code to process timer
Loop
This all works fine, but what I am finding is that the CPU usage for the application uses pretty much all of the available CPU - if nothing else is running then it uses 99%. After investigating on the net I can find information about it and it is the loop that is causing the excessive CPU usage, but I need to find someway of reducing this as it is obviously unacceptable for it to be using so much.
Any help would be appreciated.
Thanks
Andrew
I have written an application in VB, which runs a constant timer to keep track of various events. Basically what happens is when the application is started a function is called from the Form_Initialize event to start the timer. The timer is in an infinite loop of the following format:
Do
DoEvents ' to allow user to exit
' code to process timer
Loop
This all works fine, but what I am finding is that the CPU usage for the application uses pretty much all of the available CPU - if nothing else is running then it uses 99%. After investigating on the net I can find information about it and it is the loop that is causing the excessive CPU usage, but I need to find someway of reducing this as it is obviously unacceptable for it to be using so much.
Any help would be appreciated.
Thanks
Andrew