home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 February / Chip_2004-02_cd1.bin / zkuste / konfig / download / msic / Help / Int / MSI_CPUUsage.int < prev    next >
Text File  |  2003-08-26  |  2KB  |  55 lines

  1. {*******************************************************}
  2. {                                                       }
  3. {         MiTeC System Information Components           }
  4. {          CPU Usage Evaluation Component               }
  5. {           version 8.2 for Delphi 5,6                  }
  6. {                                                       }
  7. {           Copyright ⌐ 1997,2002 Michal Mutl           }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. {$INCLUDE MITEC_DEF.INC}
  12.  
  13. unit MSI_CPUUsage;
  14.  
  15. interface
  16.  
  17. uses
  18.   SysUtils, Windows, Classes, ExtCtrls;
  19.  
  20. type
  21.   TOnIntervalEvent = procedure (Sender: TObject; Value: DWORD) of object;
  22.  
  23.   TMCPUUsage = class(TComponent)
  24.   private
  25.     Timer: TTimer;
  26.     FOnInterval: TOnIntervalEvent;
  27.     FReady: Boolean;
  28.     FCPUUsage: DWORD;
  29.     function GetActive: Boolean;
  30.     function GetInterval: DWORD;
  31.     procedure SetActive(const Value: Boolean);
  32.     procedure SetInterval(const Value: DWORD);
  33.     procedure OnTimer(Sender: TObject);
  34.     function GetCPUUsage: DWORD;
  35.   public
  36.     constructor Create(AOwner: TComponent); override;
  37.     destructor Destroy; override;
  38.     property CPUUsage: DWORD read GetCPUUsage;
  39.   published
  40.     property Active: Boolean read GetActive write SetActive;
  41.     property Interval: DWORD read GetInterval write SetInterval;
  42.     property OnInterval: TOnIntervalEvent read FOnInterval write FOnInterval;
  43.   end;
  44.  
  45. function InitNTCPUData: Boolean;
  46. function GetNTCPUData: comp;
  47. procedure ReleaseNTCPUData;
  48.  
  49. const
  50.   ObjCounter = 'KERNEL\CPUUsage';
  51.  
  52.  
  53. implementation
  54.  
  55.