i have an api call that gets the process id of an application (to get the path of the exe that is running) and in a terminal services environment i need to determine which Terminal Services session that process is using. I am trying to detect if the user is already in an application before logout, and the current procedure is returning the programs from different sessions, and i need to sort them out. I found documentation on msdn for a processidtosessionid api call, but they do not have a vb implementation example. has anyone used this? is this the right approach?
I have a similar issue. I need to kill any previous instances of my
app on a terminal server and not other users instances. I got
about as far as just enumerating the processes looking for the
module name matches. Maybe this will help you and if you get it
let me know how. Look at Wokawidget's post.