Ver Mensaje Individual
  #2  
Antiguo 27-11-2018
bucanero bucanero is offline
Miembro
 
Registrado: nov 2013
Ubicación: Almería, España
Posts: 208
Reputación: 11
bucanero Va camino a la fama
Hola Rc96

yo utilizo la siguiente funciónes para saber la IP del equipo y el nombre del equipo

Código Delphi [-]

uses
  Types, Winapi.Windows, Winsock;

function GetComputerName: string;
var
  buffer: array[0..255] of char;
  size: dword;
begin
  size := 256;
  if Winapi.Windows.GetComputerName(buffer, size) then
    Result := buffer
  else
    Result := ''
end;

function GetIPSystem: string;
var
  wVersionRequested: WORD;
  wsaData: TWSAData;
  p: PHostEnt;
  s: array[0..128] of char;
begin
   {Start up WinSock}
  wVersionRequested := MAKEWORD(1, 1);
  WSAStartup(wVersionRequested, wsaData);

   {Get the computer name}
  GetHostName(@s, 128);
  p := GetHostByName(@s);

   {Get the IpAddress}
  Result := iNet_ntoa(PInAddr(p^.h_addr_list^)^);

   {Close WinSock}
  WSACleanup;
end;

No se si en las ultimas versiones de DELPHI ya incluirá algunas funciones que lo hagan mas directamente

Un saludo
Responder Con Cita