dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Problem with CPU Usage

  1. #1
    Join Date
    Oct 2007
    Location
    Baroda,India
    Posts
    74

    Unhappy Problem with CPU Usage

    Hi All,

    I am using MFC Activex Control project in VS 2005.

    In my project I am doing something like hooking. I have set these hooks from application.In this hooking , I have created some windows procedure(using CALLBACK function) through which I get messages into it contineously(Messages are like when my desktop window changed,cursor position changed,anything something happens on the the screen).For this I have to check contineously for update.

    And now my problem is like that when I call this hooking function than it starts executing and it does well and here I get all tese messages perfactly but during these constant message transfering my cpu usage goes upto 50%.So, that is very bad for me I want to reduse this cpu overhead near upto 10%.So, do you have any suggetion what to do for that???

    I will Appreciate your Answer.

    Thanks in Advance.
    Ashish Bhatt,
    System Programmer

  2. #2
    Join Date
    Apr 2004
    Location
    England, Europe
    Posts
    2,492

    Re: Problem with CPU Usage

    Quote Originally Posted by ashishbhatt12
    For this I have to check contineously for update.
    If you are checking constantly then the CPU usage will be high. You need to either (a) use the Sleep function inbetween checking or (b) receive notifications from the OS when something has changed (that's the best way because then your app is sleeping most of the time).
    My hobby projects:
    www.rclsoftware.org.uk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)