Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

c++

Status
Not open for further replies.

nnnkkk

Programmer
Nov 14, 2009
5
GB
Hello.
I would like to advise how can i get ip address on my pc
and copy it to Form2->label2.
For example Im trying to show in my program,informations of internet connection speed,ip adsress... Im thinking about something like :
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Form2->ShowModal();
ShellExecute(Handle,"open","C:\\Windows\\system32\\cmd.exe",0,0,SW_SHOW);
that should be 1st step,then can i make somehow automatic command in my c++ program as ipconfig/all -> in the cmd i should see all of the required information.
Any idea how to do it ?
Im doing c++ about 4 mounts so i can say Im very new..
Thanks
 
This isn't a trivial program. To do this you will need to do several steps.
C++Builder Dev Journal Vol 9 said:
1. Initialize security attributes for the pipe we are going to create;

2. Create a pipe to receive data from the process output and error streams;

3. Configure startup information for the new process;

4. Create the new process;

5. Read and parse text received from the created process and raise events in the GUI;

6. Perform a cleanup when the new process has completed executing.

You've done step 4 but you need to do the other steps. The article I just quoted uses CreateProcess but you can still use ShellExecute with the pipe and security calls.

The article I referenced from C++ Builder Developer's Journal is for subscribers but the cost is worth it. :)


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top