delphide işlemci sıçaklığını öğrenme

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
mxforce
Üye
Mesajlar: 1
Kayıt: 16 Mar 2008 05:56

delphide işlemci sıçaklığını öğrenme

Mesaj gönderen mxforce »

arkadaşlar şimdi örnek speedfan gibi bir sürü program var bu tarz bir program yapmak istiyorum daha doğrusu sadece ve sadece işlemcinin sıçaklığını öğrenmek istiyorum bunu delphide çok uğraştım olmadı ama bana yardımcı olursanız cok sevinirim yardımlarınızı bekliyorum..
Kullanıcı avatarı
csunguray
Üye
Mesajlar: 855
Kayıt: 09 Ara 2006 05:08
Konum: Adana
İletişim:

Re: delphide işlemci sıçaklığını öğrenme

Mesaj gönderen csunguray »

Böyle bir kod buldum.

Kod: Tümünü seç


interface

uses
  Windows, SysUtils, Forms, Dialogs, Classes, ActiveX, ComObj;

function   GetObject(Value: String): IUnknown;
procedure  DisplayTemperatures;

implementation

procedure DisplayTemperatures;
var  ovObjSet:   OleVariant;
     ovObj:      OleVariant;
     ovEnum:     OleVariant;
     // Hack cast - as WMI really exposes the collection as IEnumWbemClassObject,
     // which is identical to IEnumXXXX collections
     pvEnum:     IEnumVariant;
     dwFetch:    Cardinal;
begin

  ovObjSet:=GetObject('winmgmts:{impersonationLevel=impersonate}') as IDispatch;
  ovObjSet:=ovObjSet.InstancesOf('Win32_TemperatureProbe');
  ovEnum:=ovObjSet._NewEnum;
  pvEnum:=IEnumVariant(TVarData(ovEnum).VUnknown);
  pvEnum.Reset;
  while (pvEnum.Next(1, ovObj, dwFetch) = S_OK) do
  begin
     //  CurrentReading
     //    Data type: sint32
     //    Access type: Read-only
     //    Qualifiers: Units(Tenths of degrees Centigrade)
     //    Current value indicated by the sensor. This property is inherited from CIM_NumericSensor.
     ShowMessage(ovObj.CurrentReading);
     ovObj:=Unassigned;
  end;
  pvEnum:=nil;
  ovEnum:=Unassigned;
  ovObjSet:=Unassigned;

end;

function GetObject(Value: String): IUnknown;
var  pUnk:       IUnknown;
     pmk:        IMoniker;
     pbc:        IBindCtx;
     cbEaten:    LongInt;
     clsid:      TGUID;
begin

  // Check value to determine if this is a programmatic id or a moniker
  if (CLSIDFromProgID(PWideChar(WideString(Value)), clsid) = S_OK) then
  begin
     // Attempt to get the active object, clear the result on failure
     if not(GetActiveObject(clsid, nil, result) = S_OK) then result:=nil;
  end
  else
  begin
     // Moniker name
     if (CreateBindCtx(0, pbc) = S_OK) then
     begin
        if (MkParseDisplayName(pbc, StringToOleStr(Value), cbEaten, pmk) = S_OK) then
        begin
           // Attempt to bind the moniker, clear the result on failure
           if not(BindMoniker(pmk, 0, IUnknown, result) = S_OK) then result:=nil;
           // Release the moniker
           pmk:=nil;
        end;
        // Release the bind context
        pbc:=nil;
     end;
  end;

end;

C. Sunguray
csunguray at netbilisim.kom
Net Bilişim Hizmetleri

Sıradan her programcı bilgisayarın anlayabileceği kodlar yazabilir.
Sadece iyi programcılar insanların da anlayabileceği kodlar yazarlar.
Martin Fowler (http://martinfowler.com/)
Cevapla