Ping question

I have an IP address. If I want to ping it, can I do it by using 'WinExec' or 'ShellExecute' in my program? That is, without having to write the ping functionality myself? I just want to get the ping response time, and some simple data like that. How should I go about doing this?
Thanks.
pcasxd0Asked:
Who is Participating?
 
fasterConnect With a Mentor Commented:
of course you can Exec a command and redirect the output to a file, then parse the file to get what you want.  Most of your code will be spent on parsing.
0
 
alexoCommented:
Although, if you use a Win32 platform, CreateProcess() is the correct way to go.  It also gives you more flexibility.
0
 
pcasxd0Author Commented:
I tried to use CreateProcess(), with my IP address as the lpApplicationName parameter and "ping" as the lpCommandLine parameter, with all the other parameters default. But I am getting an unhandled exception. Any ideas?
Thanks
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
alexoCommented:
Put them both in one string and use it as one of the arguments.
0
 
pcasxd0Author Commented:
Thanks, I realized that that is what I have to do, after I added the comment. I am increasing the points to 100, so that alexo, who also helped me gets points. Please give the experts 50 points each. Thanks again.
0
 
alexoCommented:
Duh!  You just gave fater 100 points and zero to me.
The process of grading is fully automated.  It is impossible to divide the points between experts.  "There can be only one"...
The usual approach is either to create a dummy question titled "for <name> only" containing text such as "for your help in question <...>".
Otherwise, you can ask Linda from customer support to do some creative point juggling (ask a 0-point question in the "experts exchange" forum).
0
 
linda101698Commented:
alexo,
Look for the question in this topic area to award you an equal number of points.


0
 
alexoCommented:
Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.