Archive: How to check if an application is running by certain user?


How to check if an application is running by certain user?
Hi,

I am wondering if there is a way how to detect if a certain application is running and by what user in a multi-user system.

I found a lot of discussions how to detect a running application with an executable name but moreover I would like to know what user is running the application. If more than one user got the application running how to get the list of the users.

I need this information in order to uninstall.
I just don’t want to uninstall in one user account if the application is still running in another user account.


Thanks for your help.
M.


You could probably do this quite easily with the .NET Process class...

Stu


Hi Afro,

I am not familiar with the .NET Process class but it sounds to me that the user needs to have the .NET framework installed. Is that correct?
Can you explain it a little more bit in detail how i could apply that process class for my purpose or direct me to a link which gives more information.

Thank you.

M.


I was wrong, the Microsoft .NET Framework does not have this functionality built in. However, you can do this using Win32 API's:
http://www.experts-exchange.com/Prog..._20628622.html
That sample is written in Delphi.

Stu


Hi Afrow,

Unfortunately I am not a member of the expert-exchange website and therefore can not see the solution.

Could you attach the solution in this thread please?

Thanks
M.


You need to scroll down further to the 'solution'. I am not logged in and I can see it.

Stu


http://pastebin.ca/772497