From: <ob...@us...> - 2007-02-08 08:08:47
|
Revision: 11186 http://svn.sourceforge.net/jvcl/?rev=11186&view=rev Author: obones Date: 2007-02-08 00:08:46 -0800 (Thu, 08 Feb 2007) Log Message: ----------- Now uses JvCPUUsage instead of a missing CPUUsage unit Modified Paths: -------------- trunk/jvcl/examples/JvSimScope/MainForm.pas Modified: trunk/jvcl/examples/JvSimScope/MainForm.pas =================================================================== --- trunk/jvcl/examples/JvSimScope/MainForm.pas 2007-02-08 08:08:02 UTC (rev 11185) +++ trunk/jvcl/examples/JvSimScope/MainForm.pas 2007-02-08 08:08:46 UTC (rev 11186) @@ -30,7 +30,7 @@ uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, JvSimScope, StdCtrls; + Dialogs, JvSimScope, StdCtrls, JvCPUUsage; type TfrmMain = class(TForm) @@ -50,10 +50,10 @@ procedure btnActivateDeactivateRandomClick(Sender: TObject); procedure btnAdjustMaxClick(Sender: TObject); private - FPrevIdleTime: LARGE_INTEGER; - FPrevSystemTime: LARGE_INTEGER; + FCPUUsage: TJvCPUUsage; public - { D\xE9clarations publiques } + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; end; var @@ -63,9 +63,6 @@ {$R *.dfm} -uses - CPUUsage; - procedure TfrmMain.btnActivateDeactivateCPUClick(Sender: TObject); begin jssCPU.Active := not jssCPU.Active; @@ -104,9 +101,23 @@ jssRandom.Maximum := LineMax; end; +constructor TfrmMain.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FCPUUsage := TJvCPUUsage.Create(Self); +end; + +destructor TfrmMain.Destroy; +begin + FCPUUsage.Free; + + inherited Destroy; +end; + procedure TfrmMain.jssCPUUpdate(Sender: TObject); begin - jssCPU.Lines[0].Position := Round(GetCPUUsage(FPrevIdleTime, FPrevSystemTime)) + jssCPU.Lines[0].Position := Round(FCPUUsage.Usage); end; procedure TfrmMain.jssRandomUpdate(Sender: TObject); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |