VB6 - setting processor time?

July 5, 2011 at 08:00:20
Specs: Windows XP, 2Ghz/ 500Mb
VB6 - I have a running program.
It does what it should but consumes 50% of the processor time and does not need anything like that.
The body of the program looks at the clipboard constantly and is within a loop looking for changes and setts the clip to default text after 10 minutes.

The only way I can see to do this is to have this in a loop and releasing it for other PC apps inside the loop with a

Do Events

command.

Now - I thought I had seen a directive somewhere to allocate time slices (as %) to a program but can't see it right now. XP does not appear to report anything like it - is it in the VB6 compile dialog?

The target PC is very fast and a far more important and demanding app only consumes 3% of the processor time.

TIA


See More: VB6 - setting processor time?

Report •


#1
July 5, 2011 at 13:43:51
There is a way of setting times slices in VB6 using API calls. You would have to do some research to find out which one. However there is a much easier way, there always is with VB6

Get rid of the loop.

Set up a timer and programme the timer to look at the chipboard every minute, or every second or every fives seconds, whatever you think is necessary.

Inside a loop it is probably checking the clipboard over a hundred times a second which is what is taking up the CPU time.

A have VB6 App that is checking the time every second and performing some commands. In two hours of the computer running it has used 10 seconds of CPU time,

Stuart


Report •
Related Solutions


Ask Question