http://lijun_1.myetang.com/delphi/delphi_4.htm
王发军写的文章为什么RasEnumConnections老是返回78?
有无解决方法

解决方案 »

  1.   

    use winsock;function LocalIP : string;
    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 := ''; 
    GetHostName(Buffer, SizeOf(Buffer)); 
    phe :=GetHostByName(buffer); 
    if phe = nil then 
    begin 
    Exit; 
    end; 
    pptr := PaPInAddr(Phe^.h_addr_list); 
    I := 0; 
    while pptr^[I] <> nil do 
    begin 
    result:=StrPas(inet_ntoa(pptr^[I]^)); 
    Inc(I); 
    end; 
    WSACleanup; 
    end; showmessage(localip);