![]()  | 
	
 
  | 
		
			
  | 	
	
	
		
		|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны | 
![]()  | 
	
	
| 
		 | 
	Опции темы | Поиск в этой теме | Опции просмотра | 
| 
		 
			 
			#1  
			
			
			
			
		 
		
		
	 | 
|||
		
		
  | 
|||
| 
	
	
		
			
			 Добрый день. для доступа к данным сервера WMI есть стандартный код, в частности функция 
		
	
		
		
		
		
		
	
		
		
	
	
	Код: 
	function MagWmiGetPropStr(WmiProp: ISWbemProperty):string ;
var
  I:integer ;
begin
  Result := '';
  if VarIsNull(WmiProp.Get_Value) then Result := 'NULL'
  else
  begin
    case WmiProp.CIMType of
    WbemCimtypeSint8,
    WbemCimtypeUint8,
    WbemCimtypeSint16,
    WbemCimtypeUint16,
    WbemCimtypeSint32,
    WbemCimtypeUint32,
    WbemCimtypeSint64:
    if VarIsArray(WmiProp.Get_Value) then
    begin
      for I := 0 to VarArrayHighBound(wmiProp.Get_Value, 1) do
      begin
        if I > 0 then Result := Result + '|' ;
        Result := Result + IntToStr(WmiProp.Get_Value [i]);
      end;
    end
    else Result := IntToStr (wmiProp.Get_Value);
    WbemCimtypeReal32,WbemCimtypeReal64:
    Result := FloatToStr(wmiProp.Get_Value);
    wbemCimtypeBoolean:
    //if Boolean(WmiProp.Get_Value) then Result := 'True' else Result := 'False';
    if (WmiProp.Get_Value) then Result := 'True' else Result := 'False';   (*начально*)
    WbemCimtypeString, WbemCimtypeUint64:
    if VarIsArray(WmiProp.Get_Value) then
    begin
      for I := 0 to VarArrayHighBound (WmiProp.Get_Value, 1) do
      begin
        if I > 0 then Result := Result + '|' ;
        Result := Result + WmiProp.Get_Value [i] ;
      end ;
    end else Result := WmiProp.Get_Value;
    WbemCimtypeDatetime:
    Result := WmiProp.Get_Value;
    WbemCimtypeReference:
    begin
      Result := wmiProp.Get_Value ;
      //Services.Get(result, 0, nil).GetObjectText_(0));  another query
    end;
    WbemCimtypeChar16:
    Result := '<16-bit character>';
    WbemCimtypeObject:
    Result := '<CIM Object>';
    end ;
  end;
end ;RAD (WinXP, XE3) недовольна вот этим : if (WmiProp.Get_Value) then Result := 'True' else Result := 'False'; пишет что "выражение должно быть логическим" что соответсвует, так как в WbemScripting_TLB метод Get_Value Код: 
	ISWbemProperty = interface(IDispatch)
    ['{1A388F98-D4BA-11D1-8B09-00600806D9B6}']
    function Get_Value: OleVariant; safecall;
end;имеет тип OleVariant Вопрос : что вообще тут можно сделать? непонятно как такой косяк вообще имеет место быть.  | 
| 
		 
			 
			#2  
			
			
			
			
		 
		
		
	 | 
||||
		
		
  | 
||||
| 
	
	
		
			
			 тип Variant переменной можно узнать через VarType() 
		
	
		
		
		
		
			
		
		
		
		
	
		
		
	
	
	 |