|
-
Sep 14th, 2005, 02:06 PM
#1
Thread Starter
Junior Member
Pinging, Netstating, Tracerting with VB
I can open cmd and write ping or netstat or tracert or something like that manually. I also know how to But if I do these thing with the shell, I can't see how the respond times were.
I'd like to create a programm to ping a IP every minute, and solve the ping times in my VB programm, so I can use them for some statistics.
I also want to do statistics about netstat and so on.
Can someone help me and tell me how to get these ping times and all the answers to netstat and tracert and all that. I just can't get the answers (outputs) to these commands.
Thanks a lot
Last edited by Brainhacker12; Sep 14th, 2005 at 02:12 PM.
-
Sep 14th, 2005, 03:46 PM
#2
Re: Pinging, Netstating, Tracerting with VB
You can pipe the results of a command and then open it, either on the screen, or else parse it with your program.
VB Code:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Const SW_SHOWNORMAL As Long = 1
Private Const SW_HIDE As Long = 0
Private Sub Command1_Click()
ShellExecute Me.hwnd, "Open", "C:\Windows\System32\CMD.exe", " /c ipconfig >> D:\Myip.txt", "D:\", SW_SHOWNORMAL
Shell "notepad D:\Myip.txt", SW_SHOWNORMAL
End Sub
-
Sep 14th, 2005, 05:48 PM
#3
Thread Starter
Junior Member
Re: Pinging, Netstating, Tracerting with VB
really nice idee, thanks
I haven't thought of the function to transver the results to a file.
That would be a possibility, but it would be mutch cooler, to read out the infos from the window with a VB programm. Is there a way?
-
Sep 14th, 2005, 05:53 PM
#4
Re: Pinging, Netstating, Tracerting with VB
Not easily. It's not hard to read a file and parse out the needed information.
PING returns data even when it fails, so it'd be easy to parse. Other commands might take more work, but I'd bet it could be done.
-
Sep 15th, 2005, 12:35 AM
#5
Addicted Member
Re: Pinging, Netstating, Tracerting with VB
Hey check out this Link great examples about pinging and great stuff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|