Assuming I already have the handle to a window, I can get the PID with GetWindowThreadProcessId. Is there a way I can get the process name without having to get all the processes and try to match my PID?
Assuming I already have the handle to a window, I can get the PID
Share
You can use
Process.GetProcessByIdto getProcess.Processhas a lot of information about the running program.Process.ProcessNamegives you the name,Process.MainModule.FileNamegives you the name of the executable file.