delphide işlemci sıçaklığını öğrenme
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
delphide işlemci sıçaklığını öğrenme
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..
Re: delphide işlemci sıçaklığını öğrenme
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/)
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/)