Autor Beitrag
Bergmann89
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Fr 16.11.07 18:40 
HI,

ich wollte fragen ob es ne Variable oder ne Funktion gibt,
mit der man die momentane Schreib/Lesegeschw. der Festplaten
auslesen kann?! Ich will mir da sowas ähnliches bastelln wie
bei Vista! Schonma Danke an alle die ne Idee/Lösung posten!

MfG & Thx Bergmann.
hathor
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Fr 16.11.07 20:38 
WMI:

Win32_PerfFormattedData_PerfDisk_PhysicalDisk
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Fr 16.11.07 20:58 
HI,

ertsma Danke, aber was is der/die/das WMI?!
Bergmann89 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Do 21.02.08 16:49 
HI,

hab mich jetzt in WMI eingelesen, aber irgendwie geht das bei mir immer noch nich!


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
function GetWMIstring (wmiHost, wmiClass, wmiProperty : string):TStringList;
var Locator:  ISWbemLocator;
var Services: ISWbemServices;
var SObject:  ISWbemObject;
var ObjSet:   ISWbemObjectSet;
var SProp:    ISWbemProperty;
var Enum:     IEnumVariant;
var Value:    Cardinal;
var TempObj:  OleVariant;
var SN: string;
begin
  result := TStringList.Create;
  try
    Locator := CoSWbemLocator.Create;
    Services :=  Locator.ConnectServer(wmiHost, 'root\cimv2''''''',''0nil);
    ObjSet := Services.ExecQuery('SELECT * FROM '+wmiClass, 'WQL', wbemFlagReturnImmediately and wbemFlagForwardOnly , nil);
    Enum :=  (ObjSet._NewEnum) as IEnumVariant;
    while (Enum.Next(1, TempObj, Value) = S_OK) do
      begin
        SObject := IUnknown(tempObj) as ISWBemObject;
        SProp := SObject.Properties_.Item(wmiProperty, 0);
        if VarIsNull(SProp.Get_Value) then result.Add('')
        else
          begin
            SN := SProp.Get_Value;
            result.Add(SN);
          end;
      end;
  except // Trap any exceptions (Not having WMI installed will cause one!)
    on exception do result.Add('');
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Button1.Caption := GetWMIstring('','Win32_PerfFormattedData_PerfDisk_PhysicalDisk','')[0];
end;


Wenn ich das so mach, dann kommt immer: nich gefunden!
Wie muss ich das ändern, damit das geht?

MfG & Thx Bergmann.