Reputation: 1071
How to get currently running application without using a system process?
Upvotes: 0
Views: 2136
Reputation: 5374
If you're using .NET, whatever mechanism you end up using, make sure that you pay attention to .NET code access security. Read MSDN documentation to see if the class, method(s) you're using requires full-trust or not. This may be an issue if your app is supposed to run in partial trust or less privileged trust environment.
Upvotes: 0
Reputation: 755587
Slight misconception here. On any given machine there can be multiple current running process. Consider the case where the machine has multiple CPU's. It's possible, and in fact likely, that each CPU will have at least a separate thread running on it. There is a very good chance that at any given time the number of processes currently running on the machine will be close to the number of processors on the system.
In the case of a single processor the act of getting the current running process is redundant. It will simply be your application.
If you want to investigate processes running on the current machine without using the Process class, you can PInvoke into the Process32First and Process32Next system calls.
Upvotes: 0
Reputation: 1915
It depends on what you look for. If you are interested in the assembly that is calling you,then you can use GetCallingAssembly. You could also use GetExecutingAssembly.
Upvotes: 6