Autor Beitrag
linux-freak-gf
Hält's aus hier
Beiträge: 13


Delphi 3
BeitragVerfasst: Di 11.03.03 14:36 
Hi

Ich suche eine Procedure oder function mit denen ich Die ip eines Computer herausfinden kann (nur im Netzwerk)?? :?:

Linux
derDoc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 623

Win Vista Prof
D2007 Prof
BeitragVerfasst: Di 11.03.03 15:44 
Sieh dir mal das hier an:
ausblenden volle Höhe 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:
uses 
  Winsock; 
{...} 

function getIPs: Tstrings; 
type 
  TaPInAddr = array[0..10] of PInAddr; 
  PaPInAddr = ^TaPInAddr; 
var 
  phe: PHostEnt; 
  pptr: PaPInAddr; 
  Buffer: array[0..63] of Char; 
  I: Integer; 
  GInitData: TWSAData; 
begin 
  WSAStartup($101, GInitData); 
  Result := TstringList.Create; 
  Result.Clear; 
  GetHostName(Buffer, SizeOf(Buffer)); 
  phe := GetHostByName(buffer); 
  if phe = nil then Exit; 
  pPtr := PaPInAddr(phe^.h_addr_list); 
  I    := 0; 
  while pPtr^[I] <> nil do 
  begin 
    Result.Add(inet_ntoa(pptr^[I]^)); 
    Inc(I); 
  end; 
  WSACleanup; 
end; 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
  Memo1.Lines := GetIps; 
end;

_________________
MfG derDoc
There are only 10 types of people: those who understand binary and those who don't.