WMI, Delphi 6 und Vista
- From: hybrid <hybrid87@xxxxxxxxx>
- Date: Fri, 07 Sep 2007 02:16:23 +0200
hi,
ich hab ein kleines problem: ich schreibe für gamers.irc eine DLL, die es ermöglicht systeminfos abzufragen. ich habe das meiste über WMI realisiert, da ich damit am meisten infos bekomme. nur das problem ist, sobald diese funktion aufgerufen wird, stürzt mIRC unter windows vista ab.
hier der verwendete code:
function GetWMIstring (wmiHost, wmiClass, wmiProperty : string; wminum: integer):string;
var
Locator: ISWbemLocator;
Services: ISWbemServices;
SObject: ISWbemObject;
ObjSet: ISWbemObjectSet;
SProp: ISWbemProperty;
Enum: IEnumVariant;
Value: Cardinal;
TempObj: OleVariant;
SN: string;
begin
try
Locator := CoSWbemLocator.Create;
Services := Locator.ConnectServer(wmiHost, 'root\cimv2', '', '', '','', 0, nil);
ObjSet := Services.ExecQuery('SELECT * FROM '+wmiClass, 'WQL',
wbemFlagReturnImmediately and wbemFlagForwardOnly , nil);
Enum := (ObjSet._NewEnum) as IEnumVariant;
while (Enum.Next(wminum, TempObj, Value) = S_OK) do
begin
SObject := IUnknown(tempObj) as ISWBemObject;
SProp := SObject.Properties_.Item(wmiProperty, 0);
begin
SN := SProp.Get_Value;
result := SN;
end;
end;
except
on exception do
result := '';
end;
end;
unter windows xp funzt alles wunderbar, nur unter vista kommt es dann zum absturz. wäre nett wenn mir einer helfen kann.
MfG Hybrid666
.
- Follow-Ups:
- Re: WMI, Delphi 6 und Vista
- From: Stefan Graf
- Re: WMI, Delphi 6 und Vista
- From: Rudy Velthuis
- Re: WMI, Delphi 6 und Vista
- From: Stefan M. Huber
- Re: WMI, Delphi 6 und Vista
- From: NineBerry Schwarz
- Re: WMI, Delphi 6 und Vista
- From: Tom Fuchs
- Re: WMI, Delphi 6 und Vista
- Prev by Date: Re: Freien physikalischen Speicher ermitteln
- Next by Date: Re: D2007 IDE Features
- Previous by thread: D2007 IDE Features
- Next by thread: Re: WMI, Delphi 6 und Vista
- Index(es):
Relevant Pages
|
|