Solved

Process Detected on Two different Desktop Sessions

Posted on 2013-10-29
6
268 Views
Last Modified: 2013-11-22
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 ?
0
Comment
Question by:KBanner
  • 4
  • 2
6 Comments
 
LVL 32

Expert Comment

by:sarabande
Comment Utility
you should add the code.

Sara
0
 

Author Comment

by:KBanner
Comment Utility
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
 
LVL 32

Accepted Solution

by:
sarabande earned 500 total points
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:KBanner
Comment Utility
Sara, Thanks so much. Let us give it a try, and get back to you.
0
 

Author Comment

by:KBanner
Comment Utility
Thks Sara, forgot to give you the points! My apologies
0
 

Author Closing Comment

by:KBanner
Comment Utility
Top notch answer
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now