Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I found one particular problem in ur implementation, it's not ur fault but the following codes:

 

Dim t As DateTime
           t = Now.AddMilliseconds(150)
           Do
               Application.DoEvents()
           Loop While t > Now

 

eats up 99% of my CPU, is there anyway to improvise it?

 

The attachment come with it might be clearer for wat i'm doing.

DeskPet_V0[1].1.zip

Posted

Any idea how to make my form always active regardless of what window i currenly viewing?

 

E.g. Even if i'm viewing IE now, the form also can be seen and not send to back of the IE

  • Leaders
Posted
eats up 99% of my CPU' date=' is there anyway to improvise it?[/quote']

Yes, the dreaded DoEvents loop will send the taskmanager CPU reading to 99% and if you have a variable speed fan for your CPU you will hear it speed up, but as far as computer performance, that 99% of your CPU usage is your program throwing CPU control to Windows and saying "I don't want it!" and Windows throwing it back and saying "Well, I don't need it!" and back and forth and back and forth wasting CPU usage. But wait! There's Hope! When a program comes along and says "But I need the CPU!" Windows will throw CPU control to that program, and when that program is done with the CPU, your app and Windows go back to hot potato.

 

In other, much simpler words, although CPU usage goes up, the CPU is still always available for other programs to use and the performance impact is much less than you might expect.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...