Can I close (note, not terminate) a user process from a service by its PID?

98 views Asked by At

My goal is to close a certain user process (screensaver) by its process ID when enumerated from my local service. I can obtain its PID, but there comes two issues, so I want to ask first before I begin implementing it. Namely:

  1. Is it possible to obtain main thread's HWND by PID from a service?

  2. Even if I have an HWND of a user process, will I be able to SendMessage it from a service?

I can obviously TerminateProcess it, I'm just trying to be "nice" first.

0

There are 0 answers