🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11404

Re: retrieve my IP Address.

#11404
From: Marcello Scala
Date: Sun, 08 Feb 2004 22:04
62 lines
2807 bytes
I cannot use IPConfig because the IP is IP of my Router and not ip assigned
by my Internet Provider.
I want the IP assigned by Internet Provider.

Thanks
Marcello

"Roberto" <casa@artecharao.com.br> ha scritto nel messaggio
news:402617e8$1@newsgroups.borland.com...
>   Try use de command line DOS  ipconfig.exe , you have to create a batch
> file to execute the ipconfig.exe and send the stdout to a file like
> ipconfig.txt , them you get the information you want
>
>
>  HANDLE hfileIP;
>  DWORD nr, FileSizeLow, FileSizeHigh, totalF;
>
>  SHELLEXECUTEINFO ExecInfo;
>  memset (&ExecInfo, 0, sizeof(ExecInfo));
>  ExecInfo.cbSize = sizeof(ExecInfo);
>  ExecInfo.lpVerb = "open";
>  ExecInfo.lpFile = "IP.bat";           // create a batch file with:
> ipconfig > ipconfig.txt
>  ExecInfo.lpParameters = "";
>  ExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
>  ExecInfo.nShow = SW_HIDE;
>  if (!ShellExecuteEx(&ExecInfo))
>     ShowMessage("Couldn't find command");
>
>  hfileIP = CreateFile("ipconfig.txt", GENERIC_READ, 0, NULL,
OPEN_EXISTING,
> FILE_ATTRIBUTE_NORMAL, NULL);
>
>  if( hfileIP!=INVALID_HANDLE_VALUE){
>      FileSizeLow=GetFileSize(hfileIP,&FileSizeHigh);
>      totalF=(FileSizeHigh * MAXDWORD) + FileSizeLow;
>      char* buffer = (char*) new CHAR[totalF+1];
>      ReadFile(hfileIP, buffer,totalF, &nr, NULL );
>      buffer[totalF]='\0';
>      Memo1->Lines->Append(buffer);     // Get all information you want
>
>      CloseHandle(hfileIP);
>  }
>
>
> Roberto
>
>
> "Marcello Scala" <mscala@emails.it> escreveu na mensagem
> news:4023de99@newsgroups.borland.com...
> > Hi All.
> > I have a Modem/router and my ip is always 192.168.0.2.
> > How can i retrieve my real IP connection?
> >
> > i'm C++ Builder 6
> >
> > Thanks
> > Marcello
> >
> >
>
>
Technical Details
Message-ID: <4026b1bb$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-05!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4023de99@newsgroups.borland.com> <402617e8$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f70891bebb04b30f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-08 14:10:15 PST
From: "Marcello Scala" <mscala@emails.it>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4023de99@newsgroups.borland.com> <402617e8$1@newsgroups.borland.com>
Subject: Re: retrieve my IP Address.
Date: Sun, 8 Feb 2004 23:04:53 +0100
Lines: 64
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 80.180.222.61
Message-ID: <4026b1bb$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076277691 80.180.222.61 (8 Feb 2004 14:01:31 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-04!sn-xit-05!sn-xit-09!supernews.com!diablo.theplanet.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail