Process Detected on Two different Desktop Sessions

Hi,
Application is running on another remote desktop session on the same PC (using remote desktop connection) and the following code is detecting both instances on the two different desktops.
What is the easiest way to  return only the number of processes  on this one remote desktop ?
KBannerAsked:
Who is Participating?
 
sarabandeConnect With a Mentor Commented:
you may check whether the "MachineName" property of the processes in the returned array would be different for the processes running at the remote desktop. if so, you could use an overload of GetProcessesByName which takes two arguments, one for the name and one for the machine.

if the machine name is not different you may check other properties for filtering. see

http://msdn.microsoft.com/en-us/library/System.Diagnostics.Process_properties(v=vs.110).aspx


Sara
0
 
sarabandeCommented:
you should add the code.

Sara
0
 
KBannerAuthor Commented:
Public Shared Function bCheck4Running(ByVal sApp As String) As Boolean

        Dim ps() As Process
        ps = System.Diagnostics.Process.GetProcessesByName(sApp) 
        'if more than one Tracker Pro open
        If ps.Length > 1 Then

            Call KillProcess("TrackerProSplashScreen") 
            MsgBox(sApp & " is already running!", MsgBoxStyle.Critical, sApp & " Failure") 

            Return True
        End If

        Return False
    End Function

Open in new window

0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
KBannerAuthor Commented:
Sara, Thanks so much. Let us give it a try, and get back to you.
0
 
KBannerAuthor Commented:
Thks Sara, forgot to give you the points! My apologies
0
 
KBannerAuthor Commented:
Top notch answer
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.