Question System.Diagnostics.Process.GetProcessesByName Responding giving True, should be False

edputt

New member
Joined
Apr 28, 2015
Messages
2
Programming Experience
1-3
Hi there I am making a Process watcher program that watches for a program, Excel in this instance, to be not responding. IF not responding wait for a threshhold and if threshhold met kill the process.


This works most of the time.. but sometimes for some reason, i wish i knew why cause then i wouldn't be bothering you all, the Responding response comes back as True instead of false.

Luckily I was able to take a snapshot of this issue and outline it.

In the picture, labeled with notations, is (A)my code with a (D)msgbox to show the incorrect information, with the (B) task manger showing it "Not Responding", and you can barely see the Excel title (C) showing "Not Responding" also.

Here is a snippet of the code, and yes i know i have "Proccess" spelled wrong all through the place, but not where it matters.


Code:
 'Funtion passes in the proccess name (not case sensetive.)
    Public Function checktime(proccessNameX As String) As Integer


        ' Set the time to kill from the textbox if its numeric
        If IsNumeric(TBKillTime.Text) Then
            timeToKill = TBKillTime.Text
        End If


        ' Pre set the FoundIt value as 0
        Dim FoundIt As Integer
        FoundIt = 0


        'Get and loop through a list of all the proccesses on the system.
        For Each proc As Process In System.Diagnostics.Process.GetProcessesByName(proccessNameX)
            'find the proccess in the list of proccesses. Note: the process and the 








            If LCase(proc.ProcessName) = LCase(proccessNameX) Then




                ' Just wanna kill the proccess no time stuff. 
                If killitnow = 1 Then
                    proc.Kill()
                    'MsgBox(proccessNameX & "has been killed as it has been longer than the amount of time aloud to be in ""Not Responding State""")
                    killitnow = 0
                End If


                MsgBox("proc.Responding = " & proc.Responding)


                If proc.Responding = False Then

Presentation1.png
 
Last edited:

edputt

New member
Joined
Apr 28, 2015
Messages
2
Programming Experience
1-3
BTW Windows 8.1 Enterprise, 64-bit, x64 processor, .net Versions installed on the machine: v2.0.50727, v4.0.30319
 
Top Bottom