AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein Delphi Aktuelle CPUFrequenz abfragen (SpeedStep)
Thema durchsuchen
Ansicht
Themen-Optionen

Aktuelle CPUFrequenz abfragen (SpeedStep)

Ein Thema von DelTurbo · begonnen am 10. Nov 2015 · letzter Beitrag vom 15. Nov 2015
 
hathor
(Gast)

n/a Beiträge
 
#7

AW: Aktuelle CPUFrequenz abfragen (SpeedStep)

  Alt 10. Nov 2015, 19:19
Die WMI-Funktion ist ohne Refresher nicht nutzbar.

Delphi-Quellcode:
// Version: 1.8.3.0
// LIABILITY DISCLAIMER
// THIS GENERATED CODE IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.
// YOU USE IT AT YOUR OWN RISK. THE AUTHOR NOT WILL BE LIABLE FOR DATA LOSS,
// DAMAGES AND LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS CODE.
//----------------------------------------------------------------------------------------------------
program GetWMI_Info;

{$APPTYPE CONSOLE}

uses
 // SysUtils, ActiveX, ComObj, Variants;
  System.SysUtils,
  Winapi.ActiveX,
  System.Win.ComObj,
  System.Variants;

const
  WbemUser =''; WbemPassword =''; WbemComputer ='localhost';
  wbemFlagForwardOnly = $00000020;

function VarToInt(const AVariant: Variant): INT64;// integer;
begin Result := StrToIntDef(Trim(VarToStr(AVariant)), 0); end;

procedure GetCIM_ProcessorInfo;
var
  FSWbemLocator : OLEVariant;
  FWMIService : OLEVariant;
  FWbemObjectSet: OLEVariant;
  FWbemObject : OLEVariant;
  oEnum : IEnumvariant;
  iValue : LongWord;
begin;
  FSWbemLocator := CreateOleObject('WbemScripting.SWbemLocator');
  FWMIService := FSWbemLocator.ConnectServer(WbemComputer, 'root\CIMV2', WbemUser, WbemPassword);
  FWbemObjectSet:= FWMIService.ExecQuery('SELECT * FROM CIM_Processor','WQL',wbemFlagForwardOnly);
  oEnum := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
  while oEnum.Next(1, FWbemObject, iValue) = 0 do
  begin
    Writeln(Format('AddressWidth %d',[VarToInt(FWbemObject.AddressWidth)]));// Uint16
    Writeln(Format('Availability %d',[VarToInt(FWbemObject.Availability)]));// Uint16
    Writeln(Format('Caption %s',[VarToStr(FWbemObject.Caption)]));// String
    Writeln(Format('ConfigManagerErrorCode %d',[VarToInt(FWbemObject.ConfigManagerErrorCode)]));// Uint32
    Writeln(Format('ConfigManagerUserConfig %s',[VarToStr(FWbemObject.ConfigManagerUserConfig)]));// Boolean
    Writeln(Format('CreationClassName %s',[VarToStr(FWbemObject.CreationClassName)]));// String
    Writeln(Format('CurrentClockSpeed %d',[VarToInt(FWbemObject.CurrentClockSpeed)]));// Uint32
    Writeln(Format('DataWidth %d',[VarToInt(FWbemObject.DataWidth)]));// Uint16
    Writeln(Format('Description %s',[VarToStr(FWbemObject.Description)]));// String
    Writeln(Format('DeviceID %s',[VarToStr(FWbemObject.DeviceID)]));// String
    Writeln(Format('ErrorCleared %s',[VarToStr(FWbemObject.ErrorCleared)]));// Boolean
    Writeln(Format('ErrorDescription %s',[VarToStr(FWbemObject.ErrorDescription)]));// String
    Writeln(Format('Family %d',[VarToInt(FWbemObject.Family)]));// Uint16
    Writeln(Format('InstallDate %s',[VarToStr(FWbemObject.InstallDate)]));// Datetime
    Writeln(Format('LastErrorCode %d',[VarToInt(FWbemObject.LastErrorCode)]));// Uint32
    Writeln(Format('LoadPercentage %d',[VarToInt(FWbemObject.LoadPercentage)]));// Uint16
    Writeln(Format('MaxClockSpeed %d',[VarToInt(FWbemObject.MaxClockSpeed)]));// Uint32
    Writeln(Format('Name %s',[VarToStr(FWbemObject.Name)]));// String
    Writeln(Format('OtherFamilyDescription %s',[VarToStr(FWbemObject.OtherFamilyDescription)]));// String
    Writeln(Format('PNPDeviceID %s',[VarToStr(FWbemObject.PNPDeviceID)]));// String
    Writeln(Format('PowerManagementCapabilities %d',[VarToInt(FWbemObject.PowerManagementCapabilities)]));// Array of Uint16
    Writeln(Format('PowerManagementSupported %s',[VarToStr(FWbemObject.PowerManagementSupported)]));// Boolean
    Writeln(Format('Role %s',[VarToStr(FWbemObject.Role)]));// String
    Writeln(Format('Status %s',[VarToStr(FWbemObject.Status)]));// String
    Writeln(Format('StatusInfo %d',[VarToInt(FWbemObject.StatusInfo)]));// Uint16
    Writeln(Format('Stepping %s',[VarToStr(FWbemObject.Stepping)]));// String
    Writeln(Format('SystemCreationClassName %s',[VarToStr(FWbemObject.SystemCreationClassName)]));// String
    Writeln(Format('SystemName %s',[VarToStr(FWbemObject.SystemName)]));// String
    Writeln(Format('UniqueId %s',[VarToStr(FWbemObject.UniqueId)]));// String
    Writeln(Format('UpgradeMethod %d',[VarToInt(FWbemObject.UpgradeMethod)]));// Uint16

    Writeln('');
    FWbemObject:=Unassigned;
  end;
end;


begin
 try
    CoInitialize(nil);
    try
      GetCIM_ProcessorInfo;
    finally
      CoUninitialize;
    end;
 except
    on E:EOleException do
        Writeln(Format('EOleException %s %x', [E.Message,E.ErrorCode]));
    on E:Exception do
        Writeln(E.Classname, ':', E.Message);
 end;
 Writeln('Press Enter to exit');
 Readln;
end.
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:01 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz