Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB Process Remote Desktop
I have developed an application that detects if it is already running using Diagnostics.Process.GetProcessesByName(Diagnostics.Process.GetCurrentProcess.ProcessName) method.
 
But I have a customer with it installed on a Server 2003 that also hosts Remote Desktop connections. When these connections try to run the program they are told it is already running though naturally they have no access to it.
 
Is there a way of detecting if a program is running within a session rather than somewhere on the host computer?
Posted 7-Jun-12 6:05am
Edited 7-Jun-12 9:44am
Maciej Los136.7K
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use a Windows function to determine if you are running on Remote Desktop (a session) or directly on the machine (host computer). Here is a Stack Overflow question with the information you need:
 
http://stackoverflow.com/questions/159910/determine-if-a-program-is-running-on-a-remote-desktop[^]
  Permalink  
Comments
losmac at 7-Jun-12 15:45pm
   
It might be it! +5
Graham Eady at 8-Jun-12 9:47am
   
Not quite the problem. I know its running in a remote session the problem is its picking up that another instance is already running elsewhere on the server. I only want to know if the program is running in this particular remote session so that every remote session has only one instance running in each. If there are 4 remote sessions running the program on the server then the server will have the program running 4 times but only once in each of the 4 remote sessions

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 7 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100