如何得到局域网中计算机的状态.(如开机/关机)和开机时间..

解决方案 »

  1.   

    //***********************************************************
    //函数名: getIpByName
    //功能: 局域网中通过计算机名得到ip
    //参数:
    //         Name: String 计算机名
    //返回值]:
    //         String:  IP
    //***********************************************************
    function TForm1.getIpByName(Name: String): String;
    var
      WSData: TWSAData;
      HostEnt: PHostEnt;
    begin
      Result := '';
      WSAstartup(2, WSData);
      HostEnt := getHostByName(PChar(Name));
      if HostEnt <> nil then
      begin
        with HostEnt^ do
          Result := Format('%d.%d.%d.%d', [Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr^[2]), Byte(h_addr^[3])]);
      end;
      WSACleanup;
    end;
      

  2.   

    取计算机名和IP我已经搞定了..但不知要取它的开机时间和MAC地址要如何做呢...
      

  3.   

    取开机时间有API函数可调,取MAC地址网上例子很多