How would I execute code in a C# application when a process (of any type) is launched on the system?
For example, if I started notepad.exe - I would be able to get the path, "C:\Windows\notepad.exe".
How would I execute code in a C# application when a process (of any type) is launched on the system?
For example, if I started notepad.exe - I would be able to get the path, "C:\Windows\notepad.exe".
Not in managed code no - you can invoke into the Win32 API using something like:
https://www.codeproject.com/articles/11985/hooking-the-native-api-and-controlling-process-cre
technically from C#, but your going to have to use windows api functions as there is no .Net equivalent.
You can however iterate currently running processes using the Process class, so if you don't care about missing short-lived processes you could just do that on a timer?