Autor Beitrag
Petros
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 131
Erhaltene Danke: 1


Delphi7, Delphi RadStudio 10 Berlin, VSC# 2015, Java 8
BeitragVerfasst: So 16.05.10 18:26 
hi ich wollte mal fragen ob mir jemand zufällig mal nen quellcode geben könnte um meine Internet IP herraus zu finden

Ich bedanke mich für eure Hilfe

MFG Petros


Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am So 16.05.2010 um 22:47
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 480

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 16.05.10 18:51 
Wenn du einen eigene Webseite hast, kannst du einfach ein kleines PHP-Skript auf deine Seite packen, das von deinem Programm aus aufrufen und die IP auslesen.
Ansonsten eine der zahlreichen "wie-ist-meine-IP"-Dienste im Netz nehmen, und die IP aus dessen Quellcode rausfriemeln. :D

_________________
We are, we were and will not be.
Petros Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 131
Erhaltene Danke: 1


Delphi7, Delphi RadStudio 10 Berlin, VSC# 2015, Java 8
BeitragVerfasst: So 16.05.10 19:18 
So danke gausi für deinen Tipp für alle die ne lösung suchen

hier der Quelltext dazu

ausblenden volle Höhe Delphi-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:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, IdBaseComponent, IdComponent, IdTCPServer,
  IdCustomHTTPServer, IdHTTPServer, IdTCPConnection, IdTCPClient, IdHTTP;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    IdHTTP2: TIdHTTP;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

function getPublicIP:String;
var
  WebAddress: string;
  idHttp1: TIdHttp;
begin
  idHttp1 := TIdHttp.Create(nil);
  WebAddress   := 'http://www.whatismyip.com/automation/n09230945.asp';
  try
     result:=idhttp1.Get(WebAddress);
  except
    on E: Exception do
    begin
      MessageDlg('Could not get IP Address! ' +
        'Please ensure you are connected to ' +
        'the Internet.', mtError, [mbOK], 0);
    end;
  end;
  result:=trim(result);
  idHttp1.Free;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
  edit1.Text:=getPublicIp; // oder halt Memo oder was Ihr halt als anzeige nutzen wollt
end;

end.


Hoffe ich kann einigen damit helfen

MFG Petros
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10184
Erhaltene Danke: 1259

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: So 16.05.10 22:52 
Moin!

user profile iconPetros hat folgendes geschrieben Zum zitierten Posting springen:
für alle die ne lösung suchen
...haben wir auch schon länger was in der Library. ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Petros Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 131
Erhaltene Danke: 1


Delphi7, Delphi RadStudio 10 Berlin, VSC# 2015, Java 8
BeitragVerfasst: Mo 17.05.10 15:43 
ja hatte ich ja schon alles abgesucht aber nix passendes gefunden und habe deinen eintraf warscheinlich übersehene gahabt hatte dann nochmal dank gausis info bei google etwas spezificher gesucht und das dann gefunden


MFG Petros
Cyberkatze
Hält's aus hier
Beiträge: 2



BeitragVerfasst: Mo 17.05.10 18:43 
ausblenden volle Höhe Delphi-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:
36:
37:
38:
39:
40:
41:
42:
43:
function HostToIP(name: stringvar Ip: string): Boolean;
var
  wsdata : TWSAData;
  hostName : array [0..255of char;
  hostEnt : PHostEnt;
  addr : PChar;
begin
  WSAStartup ($0101, wsdata);
  try
    gethostname (hostName, sizeof (hostName));
    StrPCopy(hostName, name);
    hostEnt := gethostbyname (hostName);
    if Assigned (hostEnt) then
      if Assigned (hostEnt^.h_addr_list) then begin
        addr := hostEnt^.h_addr_list^;
        if Assigned (addr) then begin
          IP := Format ('%d.%d.%d.%d', [byte (addr [0]),
          byte (addr [1]), byte (addr [2]), byte (addr [3])]);
          Result := True;
        end
        else
          Result := False;
      end
      else
        Result := False
    else begin
      Result := False;
    end;
  finally
    WSACleanup;
  end
end;


liegen auf dem Form diese componente Edit, button und Label... und für Burron mach OnClick procedure:

procedure TForm1.Button1Click(Sender: TObject);
var
  IP: string;
begin
  if HostToIp(Edit1.Text, IP) then
    Label1.Caption := IP;
end;


Moderiert von user profile iconGausi: Quote- durch Delphi-Tags ersetzt
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 17.05.10 20:12 
Ich mag bezweifeln, dass ihm dsa bei der Frage "Wie finde ich meine eigene Internet IP heraus" weiterhilft..

_________________
PROGRAMMER: A device for converting coffee into software.
Pr0g3r
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 44

Win XP
Turbo Pascal, Delphi 5&7, Ti-Basic
BeitragVerfasst: Do 20.05.10 20:09 
Du gibst einfach in die cmd.exe Ipconfig ein und dann siehst du sie :)

_________________
Ultra posse nemo obligatur.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 480

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 20.05.10 20:20 
Das bringt einem erstens nicht unbedingt was, wenn man das in seinem Delphi-Programm braucht, und zweitens gibt das (zumindest bei mir) nur die 192.168.0.irgendwas aus, und das ist mit ziemlicher Sicherheit nicht die IP, unter der ich gerade hier im Forum eingelogt bin. ;-)

_________________
We are, we were and will not be.
Petros Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 131
Erhaltene Danke: 1


Delphi7, Delphi RadStudio 10 Berlin, VSC# 2015, Java 8
BeitragVerfasst: So 23.05.10 02:21 
ja geb ich dir recht gausi wie soll mir die Ipconfig nutzen brauche bei mir nur auf Lan rechtsklick machen dann auf details und schon hab ich die selben daten aber danke für deine meinung