Olá Galera meu nome é archnael (arquinael), vou posta esse code q eu mesmo fiz e implementei como pegar o ip real usando a WinInet API e a Api do No-ip.
o retorno é muito rápido
e não trava a aplicação
o retorno é muito rápido
e não trava a aplicação
Código:
function GetRealIPAddr:Pchar; var hSession, hURL: HINTERNET; Buffer: array [0..$F] of char; BufferLen:DWORD; str:PAnsiChar; i: integer; s, R: string; begin hSession := InternetOpen('',INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); hUrl := InternetOpenUrl(hSession, PChar('http://ip1.dynupdate.no-ip.com'),nil, INTERNET_FLAG_RELOAD, 0, 0); repeat InternetReadFile(hUrl, @Buffer, Length(Buffer)-1, BufferLen); Buffer[BufferLen] := #0; Str := PAnsiChar(@Buffer); s := S+ String(str); until BufferLen = 0; {FIX} for i:= 0 to Length(s) do if S[i] in ['0'..'9','.'] then R:= R+S[i]; {} Result := Pchar(R); InternetCloseHandle(hURL); InternetCloseHandle(hSession); end;