Answer the question
In order to leave comments, you need to log in
How to send a WM_CLOSE message to an application in another session?
Everyone loves the day.
Introductory: there is a server, there are a lot of RDP sessions on it, a certain set of applications is launched in each session.
Question: How to "correctly" close applications in other people's sessions?
I tried it in c# through the Process class, using the CloseMainWindow method, but since this method causes the WM_CLOSE message to be sent, and it needs a window handle, the method does not work, since there is no window in the session from where the program is launched.
Can you please tell me any ideas how to implement this scheme? in c# or ++ or something else.
Answer the question
In order to leave comments, you need to log in
Run as administrator and get the handle / handles by the process name, get the information from which user the exe is running and if everything is OK, we end
I run as administrator, but the MainWindowHandle property is also equal to 0. Accordingly, the CloseMainWindow() method does not work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question