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!

Using the Shell Command...

Status
Not open for further replies.

klibby

Programmer
May 30, 2001
51
0
0
US
I'm trying to make a simple program to display results of netstat....

I'm using the following code to run it...


Dim lfile As String

Private Sub mnuload_Click()
Shell "netstat -aenrs >>C:\netstat.txt", vbHide
lfile = "C:\netstat.txt"
stat.LoadFile lfile
End Sub

pretty simple code... just runs the command
netstat -aenrs >>C:\netstat.txt
and prints the results of netstat to a text file...
then loads that text file into a rich text box

though, my problem... is that when it runs the shell command, it opens another instance of my program (I had that code in Form_load before... and it just ran my program about a million times...

How can I get it to NOT run another instance of my program when running the shell command?

(it works fine without running my program again when I run it from inside VB, though not after compiled)
 
in the form_Load :

If App.PrevInstance = True Then
Call MsgBox("This program is already running!", vbExclamation)
End
End If
Eric De Decker
vbg.be@vbgroup.nl

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top