VB.NET shell execute and problem with few resources

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

have a big problem with this thread, after a long time iterations i get an
error message about few system
resources
Public Function Count1(ByVal iterations As Long) As Long
Dim objInfoProc As New ProcessStartInfo
Dim reg As Regex
Dim response As String = ""
Dim amatch As Match
Dim blnDomTrouv As Boolean = False
Dim i As Integer
Dim t As Thread = Thread.CurrentThread
Dim sr As System.IO.StreamReader
For i = 1 To iterations
Dim objProcess As System.Diagnostics.Process
objProcess = New System.Diagnostics.Process
objProcess.StartInfo.FileName = "nslookup.exe"
objProcess.StartInfo.UseShellExecute = False
objProcess.StartInfo.RedirectStandardOutput = True
objProcess.StartInfo.CreateNoWindow = True
objProcess.StartInfo.Arguments = " -querytype=any " & dominio(i)
& ".com"
objProcess.Start()
sr = objProcess.StandardOutput
objProcess.WaitForExit()
objProcess.Close()
reg = New Regex("nameserver = (?<server>[^\\\s]+)")
Do While (sr.Peek() > -1)
response = sr.ReadLine()
amatch = reg.Match(response)
If (amatch.Success) Then
pinga(i) = "X"
Exit Do
End If
Loop
objProcess.Dispose()
objProcess.Close()
objProcess = Nothing
reg = Nothing
Me.txtDisplay.Invoke(New ChangeTextControlDelegate(AddressOf
SetDisplayText), New Object() {t.Name, txtDisplay, i.ToString, 1})
Next
Me.txtDisplay.Invoke(New ChangeTextControlDelegate(AddressOf
SetDisplayText), New Object() {t.Name, txtDisplay, i.ToString, -9})
Return i
End Function
 
Hi,
have a big problem with this thread, after a long time iterations i get an
error message about few system
resources

What does it say, by instance, "Should I format your disk (Y/N)?, than be
aware that you answer "N" and not "Y".

Or is the errormessage and your question something else?

:-)

Cor
 
Back
Top